33
33
34
34
@ Mojo (name = "supertest" )
35
35
public class SuperTestMavenPlugin extends AbstractMojo {
36
+
36
37
// this is the max time to wait in seconds for process termination after the stdout read is
37
38
// finished or terminated
38
39
private static final int STDOUT_POST_READ_WAIT_TIMEOUT = 10 ;
@@ -46,6 +47,10 @@ public class SuperTestMavenPlugin extends AbstractMojo {
46
47
@ Parameter (defaultValue = "${project}" , readonly = true )
47
48
MavenProject project ;
48
49
50
+
51
+ @ Parameter (property = "mavenCommand" , defaultValue = "mvn" , readonly = true )
52
+ String mavenCommand = "mvn" ;
53
+
49
54
@ Parameter (property = "mvnTestOpts" , readonly = true )
50
55
String mvnTestOpts ;
51
56
@@ -97,7 +102,8 @@ public void execute() throws MojoExecutionException, MojoFailureException {
97
102
getLog ().debug ("Test classes found: " + String .join ("," , allTestClasses ));
98
103
99
104
int exitCode ;
100
- final String command = "mvn test " + buildProcessedMvnTestOpts (artifactId , groupId );
105
+ final String command =
106
+ mavenCommand + " test " + buildProcessedMvnTestOpts (artifactId , groupId );
101
107
try {
102
108
exitCode = runShellCommand (command , "supertest run#1" );
103
109
} catch (IOException | InterruptedException e ) {
@@ -329,7 +335,7 @@ public File[] getXmlFileList(File baseDir) {
329
335
*/
330
336
public String createRerunCommand (
331
337
Set <String > allTestClasses , Map <String , List <String >> classnameToTestcaseList ) {
332
- final StringBuilder retryRun = new StringBuilder ("mvn test" );
338
+ final StringBuilder retryRun = new StringBuilder (mavenCommand + " test" );
333
339
Set <String > incompleteTests = new HashSet <>(allTestClasses );
334
340
335
341
retryRun .append (" -Dtest=" );
@@ -364,8 +370,8 @@ private void appendFailedTestCases(
364
370
String className , List <String > failedTestCaseList , StringBuilder retryRun ) {
365
371
retryRun .append (className );
366
372
367
- if (failedTestCaseList .contains ("" )) {
368
- retryRun .append ("," );
373
+ if (failedTestCaseList .contains ("" )) {
374
+ retryRun .append ("," );
369
375
return ;
370
376
}
371
377
0 commit comments