88import java .io .File ;
99import java .io .IOException ;
1010import java .nio .file .Files ;
11+ import java .nio .file .Path ;
1112import java .security .MessageDigest ;
1213import java .security .NoSuchAlgorithmException ;
1314import java .util .Arrays ;
@@ -235,15 +236,15 @@ private void performAppImageStep(String jpackage, Directory resourcesDir) {
235236 }
236237
237238 private void configureJPackageArguments (ExecSpec e , Directory resourcesDir ) {
239+ String argsFile = createArgsFile (getModulePath ().getAsPath ());
238240 e .args (
239241 "--module" ,
240242 getMainModule ().get (),
241243 "--resource-dir" ,
242244 resourcesDir .getAsFile ().getPath (),
243245 "--app-version" ,
244246 getVersion ().get (),
245- "--module-path" ,
246- getModulePath ().getAsPath (),
247+ argsFile ,
247248 "--name" ,
248249 getApplicationName ().get ());
249250 if (getApplicationDescription ().isPresent ()) {
@@ -269,6 +270,16 @@ private void configureJPackageArguments(ExecSpec e, Directory resourcesDir) {
269270 }
270271 }
271272
273+ private String createArgsFile (String modulePathAsPath ) {
274+ Path argsFile = getTemporaryDir ().toPath ().resolve ("args.txt" );
275+ try {
276+ Files .write (argsFile , List .of ("--module-path " + modulePathAsPath ));
277+ } catch (IOException e ) {
278+ return "--module-path " + modulePathAsPath ;
279+ }
280+ return argsFile .toString ();
281+ }
282+
272283 private void generateChecksums () throws NoSuchAlgorithmException , IOException {
273284 File destination = getDestination ().get ().getAsFile ();
274285 List <File > allFiles = Arrays .stream (requireNonNull (destination .listFiles ()))
0 commit comments