3232import org .apache .maven .plugins .annotations .LifecyclePhase ;
3333import org .apache .maven .plugins .annotations .Mojo ;
3434import org .apache .maven .plugins .annotations .Parameter ;
35+ import org .apache .maven .shared .utils .cli .CommandLineException ;
36+ import org .apache .maven .shared .utils .cli .CommandLineUtils ;
3537import org .jboss .as .patching .generator .PatchGenerator ;
3638
3739/**
@@ -102,6 +104,9 @@ public class PatchGenMojo extends AbstractMojo {
102104 @ Parameter ( property = "combineWith" )
103105 private File combineWith ;
104106
107+ @ Parameter ( property = "argLine" )
108+ private String argLine ;
109+
105110 @ Parameter ( property = "project.build.directory" )
106111 private File buildDirectory ;
107112
@@ -113,6 +118,11 @@ public void execute() throws MojoExecutionException {
113118 List <String > args = new ArrayList <>();
114119
115120 args .add ( "java" );
121+
122+ for ( String additionalArg : getAdditionalArgs () ) {
123+ args .add ( additionalArg );
124+ }
125+
116126 args .add ( "-cp" );
117127 args .add ( getClasspath () );
118128 args .add ( PatchGenerator .class .getName () );
@@ -181,4 +191,17 @@ private String getClasspath() {
181191
182192 return sb .toString ();
183193 }
194+
195+ private String [] getAdditionalArgs () throws MojoExecutionException {
196+ if ( argLine == null || argLine .trim ().length () == 0 ) {
197+ return new String [0 ];
198+ }
199+
200+ try {
201+ return CommandLineUtils .translateCommandline ( argLine .replace ( "\n " , " " ).replaceAll ( "\r " , " " ) );
202+ }
203+ catch (CommandLineException e ) {
204+ throw new MojoExecutionException ( "Unable to parse argLine: " + argLine , e );
205+ }
206+ }
184207}
0 commit comments