Maven Toolchains Support
See original GitHub issueDescription:
This is related to #44, however, while that issue in particular asks for multiple JDKs to be installed with a single setup-java
invocation, I would like the general setup-java
invocation to provide a Maven Toolchains declaration for the selected JDK(s).
This requires putting a toolchains.xml
file with the proper definitions into the $HOME/.m2
location of the current user, i.e. the one running Maven.
Implementation of #44 would require changes to this, i.e. all additional JDKs would have to be correctly exposed in the toolchains declaration as well.
Justification:
This would allow using setup-java
with less overhead in projects that have Maven toolchain requirements configured and also allow Gradle to pick up JDK locations automatically starting with 7.4. This was something discussed in #44 as well and is to be implemented in gradle/gradle#14903 with a different solution.
Are you willing to submit a PR? There’s a pull request: #282
Issue Analytics
- State:
- Created 2 years ago
- Reactions:15
- Comments:13 (7 by maintainers)
Top GitHub Comments
I see thanks for the explanation and for suggesting the feature. I’m happy to leave this issue open to see if it attracts more attention, but wanted to make sure you weren’t blocked.
That depends a little – the
toolchains.xml
declaration works independently from a particular Maven installation and can also be used by Gradle to streamline detection of available JDKs.To generate a useful and valid toolchains declaration for a particular JDK the following information is necessary:
1.6
,8
,16
,17
)/path/to/jdk
)Optionally, some additional useful information needs to be made available – in particular important for
setup-java
because it offers choices with side-effects:The
toolchains.xml
exists only once and can be extended to contain any number of known JDKs and allow detection/usage by Maven and Gradle. So multiplesetup-java
(or matrix?) invocations should be consumable and generate a full toolchains declaration. Any other tooling just builds on top of this and makes usingsetup-java
easier.