23
23
import java .net .URISyntaxException ;
24
24
import java .net .URL ;
25
25
import java .util .Arrays ;
26
- import java .util .Collections ;
27
26
import java .util .Properties ;
28
27
29
28
import org .apache .maven .shared .utils .Os ;
@@ -46,6 +45,7 @@ public void setUp() throws Exception {
46
45
}
47
46
48
47
@ Test
48
+ @ SuppressWarnings ("deprecation" )
49
49
public void testBuildShouldSucceed () throws MavenInvocationException , URISyntaxException {
50
50
File basedir = getBasedirForBuild ();
51
51
request .setBaseDirectory (basedir );
@@ -60,7 +60,7 @@ public void testBuildShouldSucceed() throws MavenInvocationException, URISyntaxE
60
60
public void testBuildShouldFail () throws MavenInvocationException , URISyntaxException {
61
61
File basedir = getBasedirForBuild ();
62
62
request .setBaseDirectory (basedir );
63
- request .setGoals (Arrays .asList ("clean" , "package" ));
63
+ request .addArgs (Arrays .asList ("clean" , "package" ));
64
64
65
65
InvocationResult result = invoker .execute (request );
66
66
@@ -71,7 +71,7 @@ public void testBuildShouldFail() throws MavenInvocationException, URISyntaxExce
71
71
public void testBuildShouldTimeout () throws MavenInvocationException , URISyntaxException {
72
72
File basedir = getBasedirForBuild ();
73
73
request .setBaseDirectory (basedir );
74
- request .setGoals (Arrays .asList ("clean" , "package" ));
74
+ request .addArgs (Arrays .asList ("clean" , "package" ));
75
75
request .setTimeoutInSeconds (4 );
76
76
77
77
InvocationResult result = invoker .execute (request );
@@ -93,7 +93,7 @@ public void testSpacePom() throws Exception {
93
93
File basedir = getBasedirForBuild ();
94
94
request .setBaseDirectory (basedir );
95
95
request .setPomFileName ("pom with spaces.xml" );
96
- request .setGoals ( Collections . singletonList ( "clean" ) );
96
+ request .addArg ( "clean" );
97
97
98
98
InvocationResult result = invoker .execute (request );
99
99
@@ -105,7 +105,7 @@ public void testSpaceAndSpecialCharPom() throws Exception {
105
105
File basedir = getBasedirForBuild ();
106
106
request .setBaseDirectory (basedir );
107
107
request .setPomFileName ("pom with spaces & special char.xml" );
108
- request .setGoals ( Collections . singletonList ( "clean" ) );
108
+ request .addArg ( "clean" );
109
109
110
110
InvocationResult result = invoker .execute (request );
111
111
@@ -117,7 +117,7 @@ public void testSpaceSettings() throws Exception {
117
117
File basedir = getBasedirForBuild ();
118
118
request .setBaseDirectory (basedir );
119
119
request .setUserSettingsFile (new File (basedir , "settings with spaces.xml" ));
120
- request .setGoals ( Collections . singletonList ( "validate" ) );
120
+ request .addArg ( "validate" );
121
121
122
122
InvocationResult result = invoker .execute (request );
123
123
@@ -129,7 +129,7 @@ public void testSpaceLocalRepo() throws Exception {
129
129
File basedir = getBasedirForBuild ();
130
130
request .setBaseDirectory (basedir );
131
131
request .setLocalRepositoryDirectory (new File (basedir , "repo with spaces" ));
132
- request .setGoals ( Collections . singletonList ( "validate" ) );
132
+ request .addArg ( "validate" );
133
133
134
134
InvocationResult result = invoker .execute (request );
135
135
@@ -144,7 +144,7 @@ public void testSpaceProperties() throws Exception {
144
144
props .setProperty ("key" , "value with spaces" );
145
145
props .setProperty ("key with spaces" , "value" );
146
146
request .setProperties (props );
147
- request .setGoals ( Collections . singletonList ( "validate" ) );
147
+ request .addArg ( "validate" );
148
148
149
149
InvocationResult result = invoker .execute (request );
150
150
@@ -157,7 +157,7 @@ public void testPomOutsideProject() throws Exception {
157
157
request .setBaseDirectory (basedir );
158
158
File pom = new File (basedir , "temp/pom.xml" );
159
159
request .setPomFile (pom );
160
- request .setGoals ( Collections . singletonList ( "validate" ) );
160
+ request .addArg ( "validate" );
161
161
162
162
InvocationResult result = invoker .execute (request );
163
163
@@ -168,7 +168,7 @@ public void testPomOutsideProject() throws Exception {
168
168
public void testMavenWrapperInProject () throws Exception {
169
169
File basedir = getBasedirForBuild ();
170
170
request .setBaseDirectory (basedir );
171
- request .setGoals ( Collections . singletonList ( "test-wrapper-goal" ) );
171
+ request .addArg ( "test-wrapper-goal" );
172
172
request .setMavenExecutable (new File ("./mvnw" ));
173
173
174
174
final StringBuilder outlines = new StringBuilder ();
0 commit comments