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

maven toolchain is ignored for used java executable #12943

Open
paschm opened this issue Oct 26, 2020 · 10 comments
Open

maven toolchain is ignored for used java executable #12943

paschm opened this issue Oct 26, 2020 · 10 comments
Labels
area/maven kind/bug Something isn't working

Comments

@paschm
Copy link

paschm commented Oct 26, 2020

Describe the bug
quarkus-maven-plugin apparently ignores maven toolchain configuration. i. e. if maven is run with java 8 and toolchain is configured with java 11, the quarkus-maven-plugin picks up java 8.

Expected behavior
use java from maven toolchain

Actual behavior
use java, with which maven is run

To Reproduce
see maven project code-with-quarkus.zip

Steps to reproduce the behavior:

  1. set java_home to a java 8 installation
  2. replace the value of jdkHome in toolchains.xml in project-root with a valid path to a java 11 installation
  3. exectue mvn package --global-toolchains toolchains.xml in project-root

see output:
...
[INFO] --- maven-toolchains-plugin:3.0.0:toolchain (default) @ code-with-quarkus ---
[INFO] Required toolchain: jdk [ vendor='openjdk' version='11' ]
[INFO] Found matching toolchain for type jdk: JDK[Z:\Programme\Java\jdk11]
...
[INFO] --- quarkus-maven-plugin:1.9.0.Final:build (default) @ code-with-quarkus ---
[WARNING] [io.quarkus.deployment.QuarkusAugmentor] Using Java versions older than 11 to build Quarkus applications is deprecated and will be disallowed in a future release!
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.460 s
[INFO] Finished at: 2020-10-26T11:45:36+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.9.0.Final:build (default) on project code-with-quarkus: Execution default of goal io.quarkus:quarkus-maven-plugin:1.9.0.Final:build failed: An API incompatibility was encountered while executing io.quarkus:quarkus-maven-plugin:1.9.0.Final:build: java.lang.UnsupportedClassVersionError: org/acme/config/MyConfigSourceProvider has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
[ERROR] -----------------------------------------------------
....

Environment (please complete the following information):

  • Quarkus 1.9.0.Final
  • Apache Maven 3.6.2
  • java_home set to java 8
  • maven-toolchain set to java 11
@paschm paschm added the kind/bug Something isn't working label Oct 26, 2020
@quarkusbot
Copy link

/cc @quarkusio/devtools

@paschm
Copy link
Author

paschm commented Oct 26, 2020

Issue seems to be related to #241

@paschm
Copy link
Author

paschm commented Oct 27, 2020

Also in #1452 there was a change to the now outdated class DevMojo to pick up the java executable from the maven toolchain

@paschm
Copy link
Author

paschm commented Oct 27, 2020

@aloubyansky Thank you for the pull request. Does this also fix the ignored toolchain during the package phase resp. in QuarkusAugmentor?

@aloubyansky
Copy link
Member

Unfortunately, no. The PR only fixes the DevMojo, which is a regression. Fixing the packaging looks like a bigger challenge.

@jorgebsa
Copy link

any news on this? was trying to use the maven toolchains plugin to develop with java 17 on a new project, and came across the same issue on version 2.5.3.Final

[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.5.3.Final:build (default) on project my-backend: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]         [error]: Build step io.quarkus.arc.deployment.ConfigBuildStep#generateConfigClasses threw an exception: java.lang.UnsupportedClassVersionError: my/backend/SomeConfiguration 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

@ylepikhov
Copy link

Any news?

@sithmein
Copy link

Any news?

@maxandersen
Copy link
Member

using toolchains gets more and more common as users want to try out new vs old java combinations. Whats the blocker here?

@arthur25000
Copy link

Any news ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/maven kind/bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

8 participants