32
32
import org .apache .maven .plugins .annotations .LifecyclePhase ;
33
33
import org .apache .maven .plugins .annotations .Mojo ;
34
34
import org .apache .maven .plugins .annotations .Parameter ;
35
+ import org .apache .maven .shared .utils .cli .CommandLineException ;
36
+ import org .apache .maven .shared .utils .cli .CommandLineUtils ;
35
37
import org .jboss .as .patching .generator .PatchGenerator ;
36
38
37
39
/**
@@ -102,6 +104,9 @@ public class PatchGenMojo extends AbstractMojo {
102
104
@ Parameter ( property = "combineWith" )
103
105
private File combineWith ;
104
106
107
+ @ Parameter ( property = "argLine" )
108
+ private String argLine ;
109
+
105
110
@ Parameter ( property = "project.build.directory" )
106
111
private File buildDirectory ;
107
112
@@ -113,6 +118,11 @@ public void execute() throws MojoExecutionException {
113
118
List <String > args = new ArrayList <>();
114
119
115
120
args .add ( "java" );
121
+
122
+ for ( String additionalArg : getAdditionalArgs () ) {
123
+ args .add ( additionalArg );
124
+ }
125
+
116
126
args .add ( "-cp" );
117
127
args .add ( getClasspath () );
118
128
args .add ( PatchGenerator .class .getName () );
@@ -181,4 +191,17 @@ private String getClasspath() {
181
191
182
192
return sb .toString ();
183
193
}
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
+ }
184
207
}
0 commit comments