@@ -88,7 +88,8 @@ protected ProjectBuilder createProjectBuilder(ExportMixin exportMixin) {
8888 .javaVersion (exportMixin .buildMixin .javaVersion )
8989 .mainClass (exportMixin .buildMixin .main )
9090 .moduleName (exportMixin .buildMixin .module )
91- .compileOptions (exportMixin .buildMixin .compileOptions );
91+ .compileOptions (exportMixin .buildMixin .compileOptions )
92+ .jdkManager (exportMixin .buildMixin .jdkProvidersMixin .getJdkManager ());
9293 }
9394
9495 Path getJarOutputPath () {
@@ -127,10 +128,8 @@ int apply(BuildContext ctx) throws IOException {
127128 String newPath = ctx .resolveClassPath ().getManifestPath ();
128129 if (!newPath .isEmpty ()) {
129130 Util .infoMsg ("Updating jar..." );
130- String javaVersion = exportMixin .buildMixin .javaVersion != null
131- ? exportMixin .buildMixin .javaVersion
132- : prj .getJavaVersion ();
133- JarUtil .updateJar (outputPath , createManifest (newPath ), prj .getMainClass (), javaVersion );
131+ JarUtil .updateJar (outputPath , createManifest (newPath ), prj .getMainClass (),
132+ exportMixin .buildMixin .getProjectJdk (prj ));
134133 }
135134
136135 Util .infoMsg ("Exported to " + outputPath );
@@ -178,10 +177,8 @@ int apply(BuildContext ctx) throws IOException {
178177 }
179178
180179 Util .infoMsg ("Updating jar..." );
181- String javaVersion = exportMixin .buildMixin .javaVersion != null
182- ? exportMixin .buildMixin .javaVersion
183- : prj .getJavaVersion ();
184- JarUtil .updateJar (outputPath , createManifest (newPath .toString ()), prj .getMainClass (), javaVersion );
180+ JarUtil .updateJar (outputPath , createManifest (newPath .toString ()), prj .getMainClass (),
181+ exportMixin .buildMixin .getProjectJdk (prj ));
185182 }
186183 Util .infoMsg ("Exported to " + outputPath );
187184 return EXIT_OK ;
@@ -372,7 +369,8 @@ int apply(BuildContext ctx) throws IOException {
372369 Util .verboseMsg ("Unpacking artifact: " + dep );
373370 UnpackUtil .unzip (dep .getFile (), tmpDir , false , null , ExportFatjar ::handleExistingFile );
374371 }
375- JarUtil .createJar (outputPath , tmpDir , null , prj .getMainClass (), prj .getJavaVersion ());
372+ JarUtil .createJar (outputPath , tmpDir , null , prj .getMainClass (),
373+ exportMixin .buildMixin .getProjectJdk (prj ));
376374 } finally {
377375 Util .deletePath (tmpDir , true );
378376 }
@@ -454,7 +452,7 @@ int apply(BuildContext ctx) throws IOException {
454452 }
455453 }
456454
457- String jlinkCmd = JavaUtil .resolveInJavaHome ("jlink" , null );
455+ String jlinkCmd = JavaUtil .resolveInJavaHome ("jlink" , prj . projectJdk () );
458456 String modMain = ModuleUtil .getModuleMain (prj );
459457 List <String > cps = artifacts .stream ().map (a -> a .getFile ().toString ()).collect (Collectors .toList ());
460458 List <String > cp = new ArrayList <>(artifacts .size () + 1 );
0 commit comments