Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public String asPackageName() {
return name().toLowerCase();
}

public boolean isCurrent() {
return getCurrent() == this;
}

private static OS findCurrent() {
final String name = System.getProperty("os.name");
if (name.equals("Linux")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void execute() throws MojoExecutionException {
addClasspath(project.getArtifact());
String classpathStr = classpath.stream().map(Path::toString).collect(Collectors.joining(File.pathSeparator));

Path nativeImageExecutable = getMojoJavaHome().resolve("bin").resolve(withExeSuffix("native-image"));
Path nativeImageExecutable = getMojoJavaHome().resolve("bin").resolve("native-image" + (OS.WINDOWS.isCurrent() ? ".cmd" : ""));
if (Files.isExecutable(nativeImageExecutable)) {
String nativeImageExecutableVersion = "Unknown";
Process versionCheckProcess = null;
Expand Down Expand Up @@ -268,13 +268,6 @@ public void execute() throws MojoExecutionException {
}
}

private String withExeSuffix(String basename) {
if (OS.getCurrent() == OS.WINDOWS) {
return basename + ".exe";
}
return basename;
}

private void addClasspath(Artifact artifact) throws MojoExecutionException {
if (!"jar".equals(artifact.getType())) {
getLog().warn("Ignoring non-jar type ImageClasspath Entry " + artifact);
Expand Down Expand Up @@ -421,7 +414,7 @@ public Path getJavaHome() {

@Override
public Path getJavaExecutable() {
return getJavaHome().resolve("bin").resolve(withExeSuffix("java"));
return getJavaHome().resolve("bin").resolve("java" + (OS.WINDOWS.isCurrent() ? ".exe" : ""));
}

private List<Path> getSelectedArtifactPaths(String groupId, String... artifactIds) {
Expand Down