Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.9
-
None
Description
Actually, we can only specify the toolchains.xml in ${user.home}/.m2/toolchains.xml.
However, like for the settings.xml, it would be very convenient to specify a default toolchains.xml in ${maven.home}/conf/toolchains.xml
The idea is : If there is NO ${user.home}/.m2/toolchains.xml,
then uses ${maven.home}/conf/toolchains.xml,
otherwise NONE defined.
Merging both would also be good but not necessary.
The change is very simple. Edit the file
maven-toolchain\src\main\java\org\apache\maven\toolchain\DefaultToolchainManager.java
and replace
private PersistedToolchains readToolchainSettings() throws MisconfiguredToolchainException { File tch = new File(System.getProperty("user.home"), ".m2/toolchains.xml"); if (tch.exists()) { MavenToolchainsXpp3Reader reader = new MavenToolchainsXpp3Reader(); ...
by
private PersistedToolchains readToolchainSettings() throws MisconfiguredToolchainException { File tch = null; tch = new File(System.getProperty("user.home"), ".m2/toolchains.xml"); if (tch == null || !tch.exists()) { tch = new File(System.getProperty("maven.home"), "conf/toolchains.xml"); } if (tch.exists()) { MavenToolchainsXpp3Reader reader = new MavenToolchainsXpp3Reader(); ...
I did that on my local environment by compiling this 2.0.11-SNAPSHOT class and integrating it in my maven-2.0.9-uber.jar and it works perfectly.
Attachments
Issue Links
- depends upon
-
MNG-5714 Add Merger for Maven Toolchain
- Closed
-
MNG-5717 Enrich toolchain xml with merge information
- Closed
- is depended upon by
-
MNG-5745 Add example of toolchains.xml to Maven distribution
- Closed
- is related to
-
MNG-3714 Allow specification of the toolchains.xml location on the command line
- Closed
- relates to
-
MTOOLCHAINS-5 Look for toolchains.xml in some central place
- Closed