File tree Expand file tree Collapse file tree 6 files changed +49
-3
lines changed
java/io/github/fvarrui/javapackager Expand file tree Collapse file tree 6 files changed +49
-3
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ By default it will generate next artifacts in `${outputDirectory} ` folder:
145
145
### Plugin configuration properties
146
146
147
147
| Property | Mandatory | Default value | Description |
148
- | -------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
148
+ | ---------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
149
149
| ` additionalModulePaths ` | :x : | ` [] ` | Additional module paths for ` jdeps ` . |
150
150
| ` additionalModules ` | :x : | ` [] ` | Additional modules to the ones identified by ` jdeps ` or the specified with ` modules ` property. |
151
151
| ` additionalResources ` | :x : | ` [] ` | Additional files and folders to include in the bundled app. |
@@ -186,6 +186,7 @@ By default it will generate next artifacts in `${outputDirectory} ` folder:
186
186
| ` useResourcesAsWorkingDir ` | :x : | ` true ` | Uses app resources folder as default working directory (always ` true ` on MacOS). |
187
187
| ` version ` | :x : | ` ${project.version} ` | App version. |
188
188
| ` vmArgs ` | :x : | ` [] ` | VM arguments. |
189
+ | ` appArgs ` | :x : | ` [] ` | Additional arguments when launching the application |
189
190
190
191
> [ !IMPORTANT]
191
192
> Some default values depends on the used building tool.
Original file line number Diff line number Diff line change @@ -445,6 +445,18 @@ public void setVmArgs(List<String> vmArgs) {
445
445
this .vmArgs = vmArgs ;
446
446
}
447
447
448
+ @ Input
449
+ @ Optional
450
+ private List <String > appArgs ;
451
+
452
+ public List <String > getAppArgs () {
453
+ return appArgs ;
454
+ }
455
+
456
+ public void setAppArgs (List <String > appArgs ) {
457
+ this .appArgs = appArgs ;
458
+ }
459
+
448
460
@ Input
449
461
@ Optional
450
462
private WindowsConfig winConfig ;
@@ -656,6 +668,7 @@ protected Packager createPackager() throws Exception {
656
668
.url (defaultIfNull (url , extension .getUrl ()))
657
669
.version (defaultIfNull (version , extension .getVersion (), getProject ().getVersion ().toString ()))
658
670
.vmArgs (defaultIfNull (vmArgs , extension .getVmArgs ()))
671
+ .appArgs (defaultIfNull (appArgs , extension .getAppArgs ()))
659
672
.winConfig (defaultIfNull (winConfig , extension .getWinConfig ()));
660
673
661
674
}
Original file line number Diff line number Diff line change @@ -199,6 +199,12 @@ public class PackageMojo extends AbstractMojo {
199
199
*/
200
200
@ Parameter (property = "vmArgs" , required = false )
201
201
private List <String > vmArgs ;
202
+
203
+ /**
204
+ * Additional arguments to provide to the application
205
+ */
206
+ @ Parameter (property = "appArgs" , readonly = false )
207
+ private List <String > appArgs ;
202
208
203
209
/**
204
210
* Provide your own runnable .jar (for example, a shaded .jar) instead of letting this plugin create one via
@@ -387,6 +393,7 @@ public void execute() throws MojoExecutionException {
387
393
.url (url )
388
394
.version (version )
389
395
.vmArgs (vmArgs )
396
+ .appArgs (appArgs )
390
397
.winConfig (winConfig );
391
398
392
399
// generate app, installers and bundles
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ public class PackagerSettings {
48
48
protected Platform platform ;
49
49
protected String envPath ;
50
50
protected List <String > vmArgs ;
51
+ protected List <String > appArgs ;
51
52
protected File runnableJar ;
52
53
protected Boolean copyDependencies ;
53
54
protected String jreDirectoryName ;
@@ -279,6 +280,14 @@ public List<String> getVmArgs() {
279
280
return vmArgs ;
280
281
}
281
282
283
+ /**
284
+ * Get application args
285
+ * @return Application args
286
+ */
287
+ public List <String > getAppArgs () {
288
+ return appArgs ;
289
+ }
290
+
282
291
/**
283
292
* Get runnable JAR
284
293
* @return Runnable JAR
@@ -685,6 +694,11 @@ public PackagerSettings vmArgs(List<String> vmArgs) {
685
694
return this ;
686
695
}
687
696
697
+ public PackagerSettings appArgs (List <String > appArgs ) {
698
+ this .appArgs = new ArrayList <>(appArgs );
699
+ return this ;
700
+ }
701
+
688
702
/**
689
703
* Set runnable JAR
690
704
* @param runnableJar Runnable JAR
Original file line number Diff line number Diff line change 1
1
#set ($vmArgs = $StringUtils.join ($info.vmArgs , " " ))
2
+ #set ($appArgs = $StringUtils.join ($info.appArgs , " " ))
2
3
#! / usr/ bin/ env bash
3
4
# GNU/ Linux startup script generated by JavaPackager plugin
4
5
@@ -72,6 +73,8 @@ JVMClassPath="$BINARY"
72
73
JVMClassPath+ = ":${classpath }"
73
74
#end
74
75
76
+ AppArguments= "${appArgs }"
77
+
75
78
#if ($info.useResourcesAsWorkingDir )
76
79
cd "$SCRIPTPATH "
77
80
#end
@@ -82,8 +85,8 @@ Bootstrap="$SCRIPTPATH/scripts/${info.bootstrapFile.name}" && [ -x "$Bootstrap"
82
85
#end
83
86
84
87
#if ($info.administratorRequired )
85
- pkexec env DISPLAY= $DISPLAY XAUTHORITY= $XAUTHORITY GDKBACKEND= x11 "${JAVA }" ${JVMDefaultOptions } - jar "${JVMClassPath }" $@
88
+ pkexec env DISPLAY= $DISPLAY XAUTHORITY= $XAUTHORITY GDKBACKEND= x11 "${JAVA }" ${JVMDefaultOptions } - jar "${JVMClassPath }" ${ AppArguments } $ @
86
89
#else
87
- "${JAVA }" ${JVMDefaultOptions } - jar "${JVMClassPath }" $@
90
+ "${JAVA }" ${JVMDefaultOptions } - jar "${JVMClassPath }" ${ AppArguments } $ @
88
91
#end
89
92
exit 0
Original file line number Diff line number Diff line change 124
124
<false / >
125
125
#end
126
126
</ dict>
127
+ #if ($info.appArgs )
128
+ <key>Arguments</ key>
129
+ <array>
130
+ #foreach ($appArg in $info.appArgs )
131
+ <string>$appArg </ string>
132
+ #end
133
+ </ array>
134
+ #end
127
135
<key>LSEnvironment</ key>
128
136
<dict>
129
137
#if ($info.bundleJre )
You can’t perform that action at this time.
0 commit comments