diff --git a/patch-gen-maven-plugin/pom.xml b/patch-gen-maven-plugin/pom.xml index eb31c9b..cf3109a 100644 --- a/patch-gen-maven-plugin/pom.xml +++ b/patch-gen-maven-plugin/pom.xml @@ -33,6 +33,11 @@ 3.2 provided + + org.apache.maven.shared + maven-shared-utils + 3.1.0 + diff --git a/patch-gen-maven-plugin/src/main/java/org/jboss/as/patch/generator/maven/plugin/PatchGenMojo.java b/patch-gen-maven-plugin/src/main/java/org/jboss/as/patch/generator/maven/plugin/PatchGenMojo.java index d3b9546..d644a58 100644 --- a/patch-gen-maven-plugin/src/main/java/org/jboss/as/patch/generator/maven/plugin/PatchGenMojo.java +++ b/patch-gen-maven-plugin/src/main/java/org/jboss/as/patch/generator/maven/plugin/PatchGenMojo.java @@ -32,6 +32,8 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.shared.utils.cli.CommandLineException; +import org.apache.maven.shared.utils.cli.CommandLineUtils; import org.jboss.as.patching.generator.PatchGenerator; /** @@ -102,6 +104,9 @@ public class PatchGenMojo extends AbstractMojo { @Parameter( property = "combineWith" ) private File combineWith; + @Parameter( property = "argLine" ) + private String argLine; + @Parameter( property = "project.build.directory" ) private File buildDirectory; @@ -113,6 +118,11 @@ public void execute() throws MojoExecutionException { List args = new ArrayList<>(); args.add( "java" ); + + for ( String additionalArg : getAdditionalArgs() ) { + args.add( additionalArg ); + } + args.add( "-cp" ); args.add( getClasspath() ); args.add( PatchGenerator.class.getName() ); @@ -181,4 +191,17 @@ private String getClasspath() { return sb.toString(); } + + private String[] getAdditionalArgs() throws MojoExecutionException { + if ( argLine == null || argLine.trim().length() == 0 ) { + return new String[0]; + } + + try { + return CommandLineUtils.translateCommandline( argLine.replace( "\n", " " ).replaceAll( "\r", " " ) ); + } + catch (CommandLineException e) { + throw new MojoExecutionException( "Unable to parse argLine: " + argLine, e ); + } + } }