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

jbang --java 17 when default is java 11 build integration fails #1084

Closed
maxandersen opened this issue Nov 16, 2021 · 5 comments · Fixed by #1290
Closed

jbang --java 17 when default is java 11 build integration fails #1084

maxandersen opened this issue Nov 16, 2021 · 5 comments · Fixed by #1290
Labels
bug Something isn't working

Comments

@maxandersen
Copy link
Collaborator

Describe the bug
Have java 11 in system path.
Run jbang --java 17 https://gist.github.com/rivasdiaz/f2e9efd1bf2079f0101f865846af2502 and you get error about

Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.arc.deployment.ConfigBuildStep#generateConfigClasses threw an exception: java.lang.UnsupportedClassVersionError: MavenStatsConfig has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
        at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:445)
        at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:405)
        at io.quarkus.deployment.configuration.ConfigMappingUtils.toClass(ConfigMappingUtils.java:93)
        at io.quarkus.deployment.configuration.ConfigMappingUtils.generateConfigClasses(ConfigMappingUtils.java:51)

as if it compiles with java 17 but then falls back to running quarkus build integration with java 11...

solution would be to run that integration externally when jbang is running with lower version.

or at least help with info to user on what is happening.

@maxandersen maxandersen added the bug Something isn't working label Nov 16, 2021
@maxandersen maxandersen moved this to Todo in Road to 1.0 Nov 16, 2021
@quintesse
Copy link
Contributor

Well, that's logical, the user might specify --java 17 but that doesn't mean that JBang itself runs with that version. JBang can't know what version you specified until it parsed those options and by then it's too late :-)
You can use JBANG_DEFAULT_JAVA_VERSION=17 jbang .... but that's of course not very user-friendly.
It's one of the reasons we really need to make that integration stuff run externally (as you mention).
Until then we might be able to give a better message indeed.

@maxandersen
Copy link
Collaborator Author

Yeah it's logical; but I tell you that even though i wrote the damn thing it took me about 15 tries of trying out tons of stuff before it clicked :)

@nandorholozsnyak
Copy link
Contributor

I've just bumped into the same problem, Java 8 set as default version to run JBang, Java 11 set in the script and during the build error happens, just with different versions.
Any progress or idea on it?

@maxandersen
Copy link
Collaborator Author

no progress on it yet, but we know the solution.

  1. for now detect the java version mismatch and inform/warn the user
  2. change integration to run in external process when java versions doesn't match

quintesse added a commit to quintesse/jbang that referenced this issue Mar 10, 2022
Checks if the requested Java version is the same as the one JBang is
using and if not it will start a sub process to handle the integration
with the correct JDK.

Fixes jbangdev#1084
@quintesse
Copy link
Contributor

See #1290 :-)

quintesse added a commit to quintesse/jbang that referenced this issue Mar 13, 2022
Checks if the requested Java version is the same as the one JBang is
using and if not it will start a sub process to handle the integration
with the correct JDK.

Fixes jbangdev#1084
quintesse added a commit to quintesse/jbang that referenced this issue Mar 13, 2022
Checks if the requested Java version is the same as the one JBang is
using and if not it will start a sub process to handle the integration
with the correct JDK.

Fixes jbangdev#1084
Repository owner moved this from Todo to Done in Road to 1.0 Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants