File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
com.oracle.svm.core/src/com/oracle/svm/core
native-image-maven-plugin/src/main/java/com/oracle/substratevm Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,10 @@ public String asPackageName() {
5252 return name ().toLowerCase ();
5353 }
5454
55+ public boolean isCurrent () {
56+ return getCurrent () == this ;
57+ }
58+
5559 private static OS findCurrent () {
5660 final String name = System .getProperty ("os.name" );
5761 if (name .equals ("Linux" )) {
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ public void execute() throws MojoExecutionException {
175175 addClasspath (project .getArtifact ());
176176 String classpathStr = classpath .stream ().map (Path ::toString ).collect (Collectors .joining (File .pathSeparator ));
177177
178- Path nativeImageExecutable = getMojoJavaHome ().resolve ("bin" ).resolve (withExeSuffix ( "native-image" ));
178+ Path nativeImageExecutable = getMojoJavaHome ().resolve ("bin" ).resolve ("native-image" + ( OS . WINDOWS . isCurrent () ? ".cmd" : " " ));
179179 if (Files .isExecutable (nativeImageExecutable )) {
180180 String nativeImageExecutableVersion = "Unknown" ;
181181 Process versionCheckProcess = null ;
@@ -268,13 +268,6 @@ public void execute() throws MojoExecutionException {
268268 }
269269 }
270270
271- private String withExeSuffix (String basename ) {
272- if (OS .getCurrent () == OS .WINDOWS ) {
273- return basename + ".exe" ;
274- }
275- return basename ;
276- }
277-
278271 private void addClasspath (Artifact artifact ) throws MojoExecutionException {
279272 if (!"jar" .equals (artifact .getType ())) {
280273 getLog ().warn ("Ignoring non-jar type ImageClasspath Entry " + artifact );
@@ -421,7 +414,7 @@ public Path getJavaHome() {
421414
422415 @ Override
423416 public Path getJavaExecutable () {
424- return getJavaHome ().resolve ("bin" ).resolve (withExeSuffix ( "java" ));
417+ return getJavaHome ().resolve ("bin" ).resolve ("java" + ( OS . WINDOWS . isCurrent () ? ".exe" : " " ));
425418 }
426419
427420 private List <Path > getSelectedArtifactPaths (String groupId , String ... artifactIds ) {
You can’t perform that action at this time.
0 commit comments