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 import java.util.HashMap;
27 import java.util.Map;
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 public class MavenITmng6118SubmoduleInvocation extends AbstractMavenIntegrationTestCase
43 {
44 private static final String RESOURCE_PATH = "/mng-6118-submodule-invocation-full-reactor";
45 private final File testDir;
46 private final Map<String, String> envVars = new HashMap<>();
47
48 public MavenITmng6118SubmoduleInvocation() throws IOException
49 {
50 super( "[4.0.0-alpha-1,)" );
51 testDir = ResourceExtractor.simpleExtractResources( getClass(), RESOURCE_PATH );
52 }
53
54
55
56
57
58
59 public void testInSubModule() throws Exception
60 {
61
62 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
63 verifier.executeGoal( "compile", envVars );
64
65 final File submoduleDirectory = new File( testDir, "app" );
66 verifier = newVerifier( submoduleDirectory.getAbsolutePath() );
67 verifier.setAutoclean( false );
68 verifier.setLogFileName( "log-insubmodule.txt" );
69 verifier.executeGoal( "compile", envVars );
70 }
71
72
73
74
75
76
77 public void testWithFile() throws Exception
78 {
79
80 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
81 verifier.executeGoal( "compile" );
82
83 verifier = newVerifier( testDir.getAbsolutePath() );
84 verifier.setAutoclean( false );
85 verifier.setLogFileName( "log-withfile.txt" );
86 verifier.addCliOption( "-f app/pom.xml" );
87 verifier.executeGoal( "compile", envVars );
88 }
89
90
91
92
93
94
95 public void testWithFileAndAlsoMake() throws Exception
96 {
97 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
98 verifier.addCliOption( "-am" );
99 verifier.addCliOption( "-f app/pom.xml" );
100 verifier.setLogFileName( "log-withfilealsomake.txt" );
101 verifier.executeGoal( "compile", envVars );
102 verifier.verifyTextInLog( "Building Maven Integration Test :: MNG-6118 :: Library 1.0" );
103 }
104
105
106
107
108
109
110 public void testInSubModuleWithAlsoMake() throws Exception
111 {
112 File submoduleDirectory = new File( testDir, "app" );
113 Verifier verifier = newVerifier( submoduleDirectory.getAbsolutePath() );
114 verifier.addCliOption( "-am" );
115 verifier.setLogFileName( "log-insubmodulealsomake.txt" );
116 verifier.executeGoal( "compile", envVars );
117 verifier.verifyTextInLog( "Building Maven Integration Test :: MNG-6118 :: Library 1.0" );
118 }
119 }