Discussion:
[jira] [Created] (MTOOLCHAINS-18) toolchain.xml file should support environment variables
Nicolas Radde (JIRA)
2016-07-06 15:00:15 UTC
Permalink
Nicolas Radde created MTOOLCHAINS-18:
----------------------------------------

Summary: toolchain.xml file should support environment variables
Key: MTOOLCHAINS-18
URL: https://issues.apache.org/jira/browse/MTOOLCHAINS-18
Project: Maven Toolchains Plugin
Issue Type: Improvement
Affects Versions: 1.1
Environment: Windows 7 64bit
Reporter: Nicolas Radde
Priority: Minor


When the toolchain.xml file is configured as follow :
{code:xml}
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
<vendor>sun</vendor>
</provides>
<configuration>
<jdkHome>${env.JDK_HOME_8}</jdkHome>
</configuration>
</toolchain>
{code}

The execution of a maven compile fail with the following error :
{noformat}
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-toolchains-plugin:
1.1:toolchain (default) on project monitoring-mq-web: Misconfigured toolchains.
Non-existing JDK home configuration at L:\test-monitoring-mq\${env.JDK_HOME_8} -> [Help 1]
{noformat}
While the environment variable *JDK_HOME_8* exist.

Using environment variable is a very convenient way to have the same toolchain.xml file for all developers or jenkins slaves and would be a nice addition to the plugin.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Karl Heinz Marbaise (JIRA)
2017-08-13 17:58:02 UTC
Permalink
[ https://issues.apache.org/jira/browse/MTOOLCHAINS-18?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16124997#comment-16124997 ]

Karl Heinz Marbaise commented on MTOOLCHAINS-18:
------------------------------------------------

Maybe I misunderstand a thing but if you use an environment variable why not using {{JAVA_HOME}} ? Otherwise from my point of view the usage of {{toolchains.xml}} does not make sense?
Post by Nicolas Radde (JIRA)
toolchain.xml file should support environment variables
-------------------------------------------------------
Key: MTOOLCHAINS-18
URL: https://issues.apache.org/jira/browse/MTOOLCHAINS-18
Project: Maven Toolchains Plugin
Issue Type: Improvement
Affects Versions: 1.1
Environment: Windows 7 64bit
Reporter: Nicolas Radde
Priority: Minor
{code:xml}
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
<vendor>sun</vendor>
</provides>
<configuration>
<jdkHome>${env.JDK_HOME_8}</jdkHome>
</configuration>
</toolchain>
{code}
{noformat}
1.1:toolchain (default) on project monitoring-mq-web: Misconfigured toolchains.
Non-existing JDK home configuration at L:\test-monitoring-mq\${env.JDK_HOME_8} -> [Help 1]
{noformat}
While the environment variable *JDK_HOME_8* exist.
Using environment variable is a very convenient way to have the same toolchain.xml file for all developers or jenkins slaves and would be a nice addition to the plugin.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Nicolas Radde (JIRA)
2017-08-14 07:56:01 UTC
Permalink
[ https://issues.apache.org/jira/browse/MTOOLCHAINS-18?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16125349#comment-16125349 ]

Nicolas Radde commented on MTOOLCHAINS-18:
------------------------------------------

Hello Karl !
We have multiple JDK's installed, if i use JAVA_HOME unfortunately i can only target one of them. I do believe the purpose of the toolchains.xml file is also to allow the configuration of multiples compilation tools.

That being said, i don't thing it is working with JAVA_HOME as en environment variable either.
Post by Nicolas Radde (JIRA)
toolchain.xml file should support environment variables
-------------------------------------------------------
Key: MTOOLCHAINS-18
URL: https://issues.apache.org/jira/browse/MTOOLCHAINS-18
Project: Maven Toolchains Plugin
Issue Type: Improvement
Affects Versions: 1.1
Environment: Windows 7 64bit
Reporter: Nicolas Radde
Priority: Minor
{code:xml}
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
<vendor>sun</vendor>
</provides>
<configuration>
<jdkHome>${env.JDK_HOME_8}</jdkHome>
</configuration>
</toolchain>
{code}
{noformat}
1.1:toolchain (default) on project monitoring-mq-web: Misconfigured toolchains.
Non-existing JDK home configuration at L:\test-monitoring-mq\${env.JDK_HOME_8} -> [Help 1]
{noformat}
While the environment variable *JDK_HOME_8* exist.
Using environment variable is a very convenient way to have the same toolchain.xml file for all developers or jenkins slaves and would be a nice addition to the plugin.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Karl Heinz Marbaise (JIRA)
2017-08-14 16:17:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MTOOLCHAINS-18?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16125905#comment-16125905 ]

Karl Heinz Marbaise commented on MTOOLCHAINS-18:
------------------------------------------------

Yes of course, than you can use the entries in {{toolchains.xml}} but why do you need the environment variables? That's exactly what toolchains solves...maybe you can elaborate more in detail what the problem is and how the usage of an environment variable could help here...
Post by Nicolas Radde (JIRA)
toolchain.xml file should support environment variables
-------------------------------------------------------
Key: MTOOLCHAINS-18
URL: https://issues.apache.org/jira/browse/MTOOLCHAINS-18
Project: Maven Toolchains Plugin
Issue Type: Improvement
Affects Versions: 1.1
Environment: Windows 7 64bit
Reporter: Nicolas Radde
Priority: Minor
{code:xml}
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
<vendor>sun</vendor>
</provides>
<configuration>
<jdkHome>${env.JDK_HOME_8}</jdkHome>
</configuration>
</toolchain>
{code}
{noformat}
1.1:toolchain (default) on project monitoring-mq-web: Misconfigured toolchains.
Non-existing JDK home configuration at L:\test-monitoring-mq\${env.JDK_HOME_8} -> [Help 1]
{noformat}
While the environment variable *JDK_HOME_8* exist.
Using environment variable is a very convenient way to have the same toolchain.xml file for all developers or jenkins slaves and would be a nice addition to the plugin.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Joerg Schaible (JIRA)
2017-08-14 17:13:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MTOOLCHAINS-18?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16125995#comment-16125995 ]

Joerg Schaible commented on MTOOLCHAINS-18:
-------------------------------------------

This is typical in Linux environments. See I have:

$ java-config -L
The following VMs are available for generation-2:
1) Blackdown JDK 1.4.2.03 [blackdown-jdk-1.4.2]
2) IBM JDK 1.4.2.13_p9 [ibm-jdk-bin-1.4]
3) IBM JDK 1.5.0.12_p5 [ibm-jdk-bin-1.5]
4) IBM JDK 1.6.0.9_p2 [ibm-jdk-bin-1.6]
5) IBM JDK 1.7.0.5 [ibm-jdk-bin-1.7]
6) IcedTea JDK 6.1.13.9 [icedtea-6]
7) IcedTea JDK 7.2.6.10 [icedtea-bin-7]
8) IcedTea JDK 3.5.1 [icedtea-bin-8]
9) JamVM JDK 2.0.0 [jamvm]
10) Oracle JDK 1.7.0.80 [oracle-jdk-bin-1.7]
*) Oracle JDK 1.8.0.144 [oracle-jdk-bin-1.8]
12) Oracle JDK 1.9.0.0_beta167 [oracle-jdk-bin-1.9]
13) Sun JDK 1.5.0.22 [sun-jdk-1.5] (Build Only)
14) Sun JDK 1.6.0.45 [sun-jdk-1.6]

I can request the Java home of each individual JRE/JDK:

$ java-config --select-vm=icedtea-bin-8 -O
/opt/icedtea-bin-3.5.1

Therefore I can setup individual environment variables:

$ env | grep JAVA_
JAVA_1_8_HOME_ICE=/opt/icedtea-bin-3.5.1
JAVA_1_9_HOME_ORACLE=/opt/oracle-jdk-bin-1.9.0.0_beta167
JAVA_1_4_HOME_BD=/opt/blackdown-jdk-1.4.2.03
JAVA_1_7_HOME_ICE=/opt/icedtea-bin-7.2.6.10
JAVA_1_5_HOME_IBM=/opt/ibm-jdk-bin-1.5.0.12_p5
JAVA_1_6_HOME_ORACLE=/opt/sun-jdk-1.6.0.45
JAVA_1_6_HOME_ICE=/usr/lib64/icedtea6
JAVA_1_7_HOME_ORACLE=/opt/oracle-jdk-bin-1.7.0.80
JAVA_HOME=/home/joehni/.gentoo/java-config-2/current-user-vm
JAVA_1_8_HOME_ORACLE=/opt/oracle-jdk-bin-1.8.0.144
JAVA_1_7_HOME_IBM=/opt/ibm-jdk-bin-1.7.0.5
JAVA_1_6_HOME_IBM=/opt/ibm-jdk-bin-1.6.0.9_p2
JAVA_1_5_HOME_ORACLE=/opt/sun-jdk-1.5.0.22

Now, imagine what happens if a vulnerability is found. The distribution will update the package and it will get installed with the next update of the system (sometimes with a long list of other packages).

All environment variables will point to the new location automatically while for toolchains I have to recognize the update and will have to edit the configuration file manually each time.
Post by Nicolas Radde (JIRA)
toolchain.xml file should support environment variables
-------------------------------------------------------
Key: MTOOLCHAINS-18
URL: https://issues.apache.org/jira/browse/MTOOLCHAINS-18
Project: Maven Toolchains Plugin
Issue Type: Improvement
Affects Versions: 1.1
Environment: Windows 7 64bit
Reporter: Nicolas Radde
Priority: Minor
{code:xml}
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
<vendor>sun</vendor>
</provides>
<configuration>
<jdkHome>${env.JDK_HOME_8}</jdkHome>
</configuration>
</toolchain>
{code}
{noformat}
1.1:toolchain (default) on project monitoring-mq-web: Misconfigured toolchains.
Non-existing JDK home configuration at L:\test-monitoring-mq\${env.JDK_HOME_8} -> [Help 1]
{noformat}
While the environment variable *JDK_HOME_8* exist.
Using environment variable is a very convenient way to have the same toolchain.xml file for all developers or jenkins slaves and would be a nice addition to the plugin.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Nicolas Radde (JIRA)
2017-08-16 11:42:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MTOOLCHAINS-18?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128661#comment-16128661 ]

Nicolas Radde commented on MTOOLCHAINS-18:
------------------------------------------

While you can do without, i do believe adding support for environment variables is a plus, especially for big deployment.
We have an install of Jenkins with a good number of slaves. For maintenance purpose, we use the automatic installation feature of the maven tool and the config plugin to provide config files like {noformat}settings.xml{noformat} and {noformat}toolchains.xml{noformat}.
For now, we need to have more or less one {noformat}toolchains.xml{noformat} file per slave (some slaves have the same path fortunately), while for the {noformat}settings.xml{noformat} i can have only one. It is relatively easy to setup environment variables in the Jenkins node configuration page.

If i can add another argument it would be that environment variables works in {noformat}pom.xml{noformat} and {noformat}settings.xml{noformat}, why not in {noformat}toolchains.xml{noformat} ?
Post by Nicolas Radde (JIRA)
toolchain.xml file should support environment variables
-------------------------------------------------------
Key: MTOOLCHAINS-18
URL: https://issues.apache.org/jira/browse/MTOOLCHAINS-18
Project: Maven Toolchains Plugin
Issue Type: Improvement
Affects Versions: 1.1
Environment: Windows 7 64bit
Reporter: Nicolas Radde
Priority: Minor
{code:xml}
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
<vendor>sun</vendor>
</provides>
<configuration>
<jdkHome>${env.JDK_HOME_8}</jdkHome>
</configuration>
</toolchain>
{code}
{noformat}
1.1:toolchain (default) on project monitoring-mq-web: Misconfigured toolchains.
Non-existing JDK home configuration at L:\test-monitoring-mq\${env.JDK_HOME_8} -> [Help 1]
{noformat}
While the environment variable *JDK_HOME_8* exist.
Using environment variable is a very convenient way to have the same toolchain.xml file for all developers or jenkins slaves and would be a nice addition to the plugin.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Nicolas Radde (JIRA)
2017-08-16 11:44:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MTOOLCHAINS-18?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128661#comment-16128661 ]

Nicolas Radde edited comment on MTOOLCHAINS-18 at 8/16/17 11:43 AM:
--------------------------------------------------------------------

While you can do without, i do believe adding support for environment variables is a plus, especially for big deployment.
We have an install of Jenkins with a good number of slaves. For maintenance purpose, we use the automatic installation feature of the maven tool and the config plugin to provide config files like settings.xml and toolchains.xml.
For now, we need to have more or less one toolchains.xml file per slave (some slaves have the same path fortunately), while for the settings.xml i can have only one. It is relatively easy to setup environment variables in the Jenkins node configuration page.

If i can add another argument it would be that environment variables works in pom.xml and settings.xml, why not in toolchains.xml ?




was (Author: nickho):
While you can do without, i do believe adding support for environment variables is a plus, especially for big deployment.
We have an install of Jenkins with a good number of slaves. For maintenance purpose, we use the automatic installation feature of the maven tool and the config plugin to provide config files like {noformat}settings.xml{noformat} and {noformat}toolchains.xml{noformat}.
For now, we need to have more or less one {noformat}toolchains.xml{noformat} file per slave (some slaves have the same path fortunately), while for the {noformat}settings.xml{noformat} i can have only one. It is relatively easy to setup environment variables in the Jenkins node configuration page.

If i can add another argument it would be that environment variables works in {noformat}pom.xml{noformat} and {noformat}settings.xml{noformat}, why not in {noformat}toolchains.xml{noformat} ?
Post by Nicolas Radde (JIRA)
toolchain.xml file should support environment variables
-------------------------------------------------------
Key: MTOOLCHAINS-18
URL: https://issues.apache.org/jira/browse/MTOOLCHAINS-18
Project: Maven Toolchains Plugin
Issue Type: Improvement
Affects Versions: 1.1
Environment: Windows 7 64bit
Reporter: Nicolas Radde
Priority: Minor
{code:xml}
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
<vendor>sun</vendor>
</provides>
<configuration>
<jdkHome>${env.JDK_HOME_8}</jdkHome>
</configuration>
</toolchain>
{code}
{noformat}
1.1:toolchain (default) on project monitoring-mq-web: Misconfigured toolchains.
Non-existing JDK home configuration at L:\test-monitoring-mq\${env.JDK_HOME_8} -> [Help 1]
{noformat}
While the environment variable *JDK_HOME_8* exist.
Using environment variable is a very convenient way to have the same toolchain.xml file for all developers or jenkins slaves and would be a nice addition to the plugin.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Javier A. Ortiz (JIRA)
2018-02-08 20:11:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MTOOLCHAINS-18?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16357508#comment-16357508 ]

Javier A. Ortiz commented on MTOOLCHAINS-18:
--------------------------------------------

I completely agree. I tried this and was surprised to see it doesn't work like any other maven configuration file.

Kind of beats the purpose if it needs to be updated as well as the environment variables.
Post by Nicolas Radde (JIRA)
toolchain.xml file should support environment variables
-------------------------------------------------------
Key: MTOOLCHAINS-18
URL: https://issues.apache.org/jira/browse/MTOOLCHAINS-18
Project: Maven Toolchains Plugin
Issue Type: Improvement
Affects Versions: 1.1
Environment: Windows 7 64bit
Reporter: Nicolas Radde
Priority: Minor
{code:xml}
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
<vendor>sun</vendor>
</provides>
<configuration>
<jdkHome>${env.JDK_HOME_8}</jdkHome>
</configuration>
</toolchain>
{code}
{noformat}
1.1:toolchain (default) on project monitoring-mq-web: Misconfigured toolchains.
Non-existing JDK home configuration at L:\test-monitoring-mq\${env.JDK_HOME_8} -> [Help 1]
{noformat}
While the environment variable *JDK_HOME_8* exist.
Using environment variable is a very convenient way to have the same toolchain.xml file for all developers or jenkins slaves and would be a nice addition to the plugin.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Loading...