[ 
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.

> 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.4.14#64029)

Reply via email to