So it does. However, it looks like the settings.xml definitions override the environment variables.
I'll update the docs On 9 January 2015 at 18:28, Bernd Eckenfels <[email protected]> wrote: > Hello, > > BTW: it also works without defining properties if you define > JAVA_1_x_HOME environment variables. > > Gruss > Bernd > > Am Fri, 09 Jan 2015 17:14:09 -0000 > schrieb [email protected]: > >> Author: sebb >> Date: Fri Jan 9 17:14:08 2015 >> New Revision: 1650603 >> >> URL: http://svn.apache.org/r1650603 >> Log: >> Bring java profile list up to date and provide more examples >> >> Modified: >> commons/cms-site/trunk/content/xdoc/commons-parent-pom.xml >> >> Modified: commons/cms-site/trunk/content/xdoc/commons-parent-pom.xml >> URL: >> http://svn.apache.org/viewvc/commons/cms-site/trunk/content/xdoc/commons-parent-pom.xml?rev=1650603&r1=1650602&r2=1650603&view=diff >> ============================================================================== >> --- commons/cms-site/trunk/content/xdoc/commons-parent-pom.xml >> (original) +++ >> commons/cms-site/trunk/content/xdoc/commons-parent-pom.xml Fri Jan 9 >> 17:14:08 2015 @@ -243,20 +243,23 @@ <p> For this reason >> <a >> href="http://svn.apache.org/repos/asf/commons/proper/commons-parent/trunk/pom.xml">commons-parent</a> >> - provides <i>profiles</i> for compiling/testing under >> different Java versions: >> + provides <i>profiles</i> for compiling/testing under >> different Java versions (correct as of version 36): </p> >> <ul> >> - <li><code>java-1.3</code> for compiling and testing >> using Java 1.3</li> >> - <li><code>java-1.4</code> for compiling and testing >> using Java 1.4</li> >> - <li><code>java-1.5</code> for compiling and testing >> using Java 1.5</li> >> - <li><code>java-1.6</code> for compiling and testing >> using Java 1.6</li> >> + <li><code>java-1.3</code> for compiling and testing >> using Java 1.3 (uses property JAVA_1_3_HOME)</li> >> + <li><code>java-1.4</code> for compiling and testing >> using Java 1.4 (uses property JAVA_1_4_HOME)</li> >> + <li><code>java-1.5</code> for compiling and testing >> using Java 1.5 (uses property JAVA_1_5_HOME)</li> >> + <li><code>java-1.6</code> for compiling and testing >> using Java 1.6 (uses property JAVA_1_6_HOME)</li> >> + <li><code>java-1.7</code> for compiling and testing >> using Java 1.7 (uses property JAVA_1_7_HOME)</li> >> + <li><code>java-1.8</code> for compiling and testing >> using Java 1.8 (uses property JAVA_1_8_HOME)</li> >> + <li><code>java-1.9</code> for compiling and testing >> using Java 1.9 (uses property JAVA_1_9_HOME)</li> </ul> >> <p> >> - In order for these profiles to work, you need to configure >> the <code>JAVA_1_3_HOME</code>, >> - <code>JAVA_1_4_HOME</code>, <code>JAVA_1_5_HOME</code> and >> <code>JAVA_1_6_HOME</code> >> - properties in your <code>settings.xml</code> file (or as >> environment variables or even command-line properties). >> + In order for these profiles to work, you need to configure >> the relevant <code>JAVA_1_N_HOME</code> >> + properties in your <code>settings.xml</code> file. >> + [There is no need to configure properties for profiles you >> don't need.] Each property should be set to the >> <code>directory</code> where the relevant version of the JDK is >> installed. >> - The Maven compiler plugin has >> + Note: the Maven compiler plugin has >> <a >> href="http://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-using-different-jdk.html">documentation >> on how this works</a>. </p> <p> >> @@ -271,30 +274,29 @@ >> <source><![CDATA[ >> <settings> >> <profiles> >> + <!-- Sample profiles showing different ways of >> defining the properties --> <profile> >> - <id>java-1.3</id> >> - <properties> >> - >> <JAVA_1_3_HOME>C:\j\jdk1.3.1_18</JAVA_1_3_HOME> >> - </properties> >> - </profile> >> - <profile> >> - <id>java-1.4</id> >> + <id>java-1.5</id> >> <properties> >> - >> <JAVA_1_4_HOME>C:\j\jdk1.4.2_19</JAVA_1_4_HOME> >> + <!-- sample Windows definition --> >> + <JAVA_1_5_HOME>C:\jdk1.5.0_22</JAVA_1_5_HOME> >> </properties> >> </profile> >> <profile> >> - <id>java-1.5</id> >> + <id>java-1.6</id> >> <properties> >> - >> <JAVA_1_5_HOME>C:\j\jdk1.5.0_22</JAVA_1_5_HOME> >> + <!-- Sample Unix definition --> >> + >> <JAVA_1_6_HOME>/home/jenkins/tools/java/latest1.6</JAVA_1_6_HOME> >> </properties> </profile> >> <profile> >> - <id>java-1.6</id> >> + <id>java-1.7</id> >> <properties> >> - >> <JAVA_1_6_HOME>C:\j\jdk1.6.0_17</JAVA_1_6_HOME> >> + <!-- sample definition using an OS >> environment variable --> >> + >> <JAVA_1_7_HOME>${env.JAVA_1_7_HOME}</JAVA_1_7_HOME> </properties> >> </profile> >> + <!-- No need to define every possible java profile, >> only the ones you want to use (and have JDKs for) --> </profiles> >> </settings> >> ]]></source> >> @@ -304,10 +306,18 @@ >> the most convenient). >> </p> >> <p> >> - Once you have configured those properties you can, for >> example, compile and test with Java 1.4 using the following command: >> + Once you have configured those properties you can, for >> example, compile and test with Java 1.6 using the following command: >> + </p> >> + <source> >> + mvn clean test -Pjava-1.6 >> + </source> >> + <p> >> + If you don't want to update the <code>settings.xml</code> >> file, you can provide the property definition on the command-line. >> + (However for frequent use it is easier to update the >> settings file) >> + For example: >> </p> >> <source> >> - mvn -Pjava-1.4 clean test >> + mvn clean test -Pjava-1.6 >> -DJAVA_1_6_HOME=/home/jenkins/tools/java/latest1.6 </source> >> </subsection> >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
