maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Scholte (JIRA)" <j...@codehaus.org>
Subject [jira] (MNG-3891) Modify maven-toolchain to look in ${maven.home}/conf/toolchains.xml and in ${user.home}/.m2/toolchains.xml
Date Sat, 01 Nov 2014 18:42:10 GMT

     [ https://jira.codehaus.org/browse/MNG-3891?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Robert Scholte reopened MNG-3891:
---------------------------------


We're slowly pushing forward the runtime JDK requirement for Maven.
However, we want to keep the users in control if they want to use another (older?) JDK to
compile there code with.
Toolchain is the preferred way, so it will get a more prominent role in future releases of
Maven.
To make it easier to understand how to use it, we want to make it part of the Maven distribution.
So it will be better if toolchains will be treated the same as the {{settings.xml}}, so for
that reason this issue will be reopened.

> Modify maven-toolchain to look in ${maven.home}/conf/toolchains.xml and in ${user.home}/.m2/toolchains.xml

> -----------------------------------------------------------------------------------------------------------
>
>                 Key: MNG-3891
>                 URL: https://jira.codehaus.org/browse/MNG-3891
>             Project: Maven
>          Issue Type: Improvement
>          Components: Toolchains
>    Affects Versions: 2.0.9
>            Reporter: Marco Lessard
>             Fix For: Issues to be reviewed for 3.x
>
>
> 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 
> {code:java}
> private PersistedToolchains readToolchainSettings() throws MisconfiguredToolchainException
{
>     File tch = new File(System.getProperty("user.home"), ".m2/toolchains.xml");
>     if (tch.exists()) {
>        MavenToolchainsXpp3Reader reader = new MavenToolchainsXpp3Reader();
>        ...
> {code}
> by 
> {code:java}
> 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();
>         ...
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Mime
View raw message