1 package org.apache.maven.it;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.it.util.ResourceExtractor;
23
24 import java.io.File;
25 import java.io.IOException;
26
27 public class MavenITmng7112ProjectsWithNonRecursiveTest
28 extends AbstractMavenIntegrationTestCase
29 {
30 private static final String PROJECT_PATH = "/mng-7112-projects-with-non-recursive";
31
32 public MavenITmng7112ProjectsWithNonRecursiveTest()
33 {
34 super( "[4.0.0-alpha-1,)" );
35 }
36
37 public void testAggregatesCanBeBuiltNonRecursively()
38 throws IOException, VerificationException
39 {
40 final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH );
41 newVerifier( projectDir.getAbsolutePath() ).executeGoal( "clean" );
42
43 final Verifier verifier = newVerifier( projectDir.getAbsolutePath() );
44
45 verifier.addCliOption( "-pl" );
46 verifier.addCliOption( ":aggregator-a,:aggregator-b" );
47 verifier.addCliOption( "-N" );
48 verifier.setLogFileName( "selected-non-recursive.txt" );
49 verifier.executeGoal( "validate" );
50
51 verifier.assertFileNotPresent( "target/touch.txt" );
52 verifier.assertFilePresent( "aggregator-a/target/touch.txt" );
53 verifier.assertFileNotPresent( "aggregator-a/module-a/target/touch.txt" );
54 verifier.assertFilePresent( "aggregator-b/target/touch.txt" );
55 verifier.assertFileNotPresent( "aggregator-b/module-b/target/touch.txt" );
56 }
57
58 public void testAggregatesCanBeDeselectedNonRecursively()
59 throws IOException, VerificationException
60 {
61 final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH );
62 newVerifier( projectDir.getAbsolutePath() ).executeGoal( "clean" );
63
64 final Verifier verifier = newVerifier( projectDir.getAbsolutePath() );
65
66 verifier.addCliOption( "-pl" );
67 verifier.addCliOption( "!:aggregator-a,!:aggregator-b" );
68 verifier.addCliOption( "-N" );
69 verifier.setLogFileName( "excluded-non-recursive.txt" );
70 verifier.executeGoal( "validate" );
71
72 verifier.assertFilePresent( "target/touch.txt" );
73 verifier.assertFileNotPresent( "aggregator-a/target/touch.txt" );
74 verifier.assertFilePresent( "aggregator-a/module-a/target/touch.txt" );
75 verifier.assertFileNotPresent( "aggregator-b/target/touch.txt" );
76 verifier.assertFilePresent( "aggregator-b/module-b/target/touch.txt" );
77 }
78 }