1 package org.apache.maven.it;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.io.File;
23
24 import org.apache.maven.it.util.ResourceExtractor;
25
26 /**
27 * Test to make sure that the reactor is properly constrained when --projects is used. Previous to 3.1.2 all of the
28 * projects found in the {@code <modules/>} section of the POM were passed into the reactor. This test is a 5 project
29 * multi-module project where only project-0, and project-1 are specified to be used. The project-0 has a dependency on
30 * project-4 and in this constrained mode the dependency resolution should fail because project-4 is no longer placed in
31 * the reactor.
32 *
33 * @author jvanzyl
34 */
35 public class MavenITmng5557ProperlyRestrictedReactor
36 extends AbstractMavenIntegrationTestCase
37 {
38 public MavenITmng5557ProperlyRestrictedReactor()
39 {
40 super( "[3.1.2,)" );
41 }
42
43 public void testRunningRestrictedReactor()
44 throws Exception
45 {
46 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5557-properly-restricted-reactor" );
47 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
48 //
49 // Remove everything related to this project from the local repository as we want this to be resolution purely
50 // from the reactor.
51 //
52 verifier.deleteArtifacts( "org.apache.maven.its.mng5557" );
53 verifier.addCliOption( "--projects project-0,project-1" );
54 try
55 {
56 verifier.executeGoal( "package" );
57 }
58 catch ( VerificationException e )
59 {
60 // the execution should fail due to a resolution error.
61 }
62 verifier.resetStreams();
63 verifier.verifyTextInLog( "Could not resolve dependencies for project org.apache.maven.its.mng5557:project-0:jar:1.0: Could not find artifact org.apache.maven.its.mng5557:project-4:jar:1.0" );
64 }
65 }