linux-china/toolchains-maven-plugin

How to define multiple Java versions at once?

helpermethod opened this issue · 5 comments

A typical use case of toolchains is to use different JDKs for compiling and testing, e.g. Java 8 for building the project and Java 17 for testing.

How can I define multiple JDKs? It seems that currently only one is supported.

I guess analogue to the official plugin, <toolchains> should have a subelement <toolchain> for each JDK.

Like this? How to use different Java versions for main and test in Maven - https://vladmihalcea.com/different-java-main-test-maven/

Like this? How to use different Java versions for main and test in Maven - https://vladmihalcea.com/different-java-main-test-maven/

Exactly! While you currently can define multiple <jdk/> elements only the last one is taken into account.

Like this? How to use different Java versions for main and test in Maven - https://vladmihalcea.com/different-java-main-test-maven/

Exactly! While you currently can define multiple <jdk/> elements only the last one is taken into account.

Now multiple <jdk/> not allowed, and <testJdk/> is added to support JDK for testing. Please refer https://github.com/linux-china/toolchains-maven-plugin#different-jdk-for-maintest-code

Thanks alot!