Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractMicronautAotCliMojo fails when Maven and OS java.exe are different #1266

Open
rfscholte opened this issue Dec 18, 2024 · 0 comments
Open

Comments

@rfscholte
Copy link

To reproduce verify if mvn -v and java -version are different (ideally the latter is Java "old", like 11).

This can already be confirmed with the following ITs
[ERROR] The following builds failed:
[ERROR] * aot-sample\pom.xml
[ERROR] * issue375\pom.xml
[ERROR] * package-jar-aot\pom.xml
[ERROR] * run-aot-jvmargs\pom.xml
[ERROR] * run-aot\pom.xml

Root cause is the AbstractMicronautAotCli. This class doesn't execute java directly, but delegates it to the exec-maven-plugin. However, this one just calls "java".

    String javaExecutable = MojoUtils.findJavaExecutable(toolchainManager, mavenSession);

    return configuration(
        element("executable", javaExecutable),
        element("arguments", runnerArgs)
    );

By injecting the ToolchainManager and MavenSession and replacing this small piece of code it'll work as expected

rfscholte added a commit to rfscholte/micronaut-maven-plugin that referenced this issue Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant