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

Different java versions for mvnd and maven #512

Closed
gandadil opened this issue Oct 30, 2021 · 7 comments
Closed

Different java versions for mvnd and maven #512

gandadil opened this issue Oct 30, 2021 · 7 comments

Comments

@gandadil
Copy link

I am trying to compile a Java 7 source with mvnd but it's not supported. If there is any way to set different JAVA_HOME for mvnd and internal maven I can run mvnd with Java 11 for example and maven with Java 7. Is it possible?
I tried set java.home with Java 11 on mvnd.properties and JAVA_HOME with Java 7 but doesn't work.

@khmarbaise
Copy link
Member

You can use JDK11 runtime for all and set the --release 7 which produces JDK7 compatible code. mvnd itself needs at minimum JDK8 to run...

@gandadil
Copy link
Author

gandadil commented Oct 31, 2021

mvnd --release 7 -f pom.xml clean install -U -Dmaven.test.failure.ignore=true dependency:copy-dependencies -Dparallel=all -DperCoreThreadCount=true -DthreadCount=2 -DforkCount=2C

Unable to parse command line options: Unrecognized option: --release

@khmarbaise
Copy link
Member

khmarbaise commented Oct 31, 2021

This means you are running with JDK8 or less...that does not work. The `--release´ is available from JDK9+ As I said run your build with JDK11 and use the --release option..

Is there a reason why you are using copy-dependencies etc. ? Why ignoring test failures? And fork count?

@gnodet
Copy link
Contributor

gnodet commented Nov 3, 2021

Reopen if needed.

@gnodet gnodet closed this as completed Nov 3, 2021
@gandadil
Copy link
Author

gandadil commented Nov 3, 2021

Well, I am using Semeru distribuition of Adoptium OpenJDK 11 and is receiving this message. Maybe I need to use a distribution with Hotspot JVM instead OpenJ9?

@gnodet
Copy link
Contributor

gnodet commented Nov 3, 2021

The --release 7 is a java compiler option, not a mvnd option. This option needs to be configured on the maven compiler plugin. Also make sure your JAVA_HOME environment variable points to a JDK that does support java 7.

@gandadil
Copy link
Author

gandadil commented Nov 3, 2021

Thank you for your help. I put -Dmaven.compiler.release=7 and works.

@ppalaga ppalaga added this to the No fix/wont't fix milestone Dec 8, 2021
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

4 participants