You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "John Casey (JIRA)" <ji...@codehaus.org> on 2009/02/20 00:41:19 UTC

[jira] Commented: (MNG-3891) Modify maven-toolchain to look in ${maven.home}/conf/toolchains.xml and in ${user.home}/.m2/toolchains.xml

    [ http://jira.codehaus.org/browse/MNG-3891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=166320#action_166320 ] 

John Casey commented on MNG-3891:
---------------------------------

This approach would make the toolchains.xml file exceptional when compared to the settings.xml and other files we used to use. In the case of settings.xml, $(maven.home)/conf/settings.xml and $(user.home)/.m2/settings.xml are merged, then used. This is a significantly more involved process.

> Modify maven-toolchain to look in ${maven.home}/conf/toolchains.xml and in ${user.home}/.m2/toolchains.xml 
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: MNG-3891
>                 URL: http://jira.codehaus.org/browse/MNG-3891
>             Project: Maven 2
>          Issue Type: Improvement
>    Affects Versions: 2.0.9
>            Reporter: Marco Lessard
>             Fix For: 2.2.0-M1
>
>
> 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}
> 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}
> 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 is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira