Author: sebb
Date: Fri Jan 9 19:06:27 2015
New Revision: 1650631
URL: http://svn.apache.org/r1650631
Log:
java profiles work with OS environment variables
Modified:
commons/cms-site/trunk/content/xdoc/building.xml
commons/cms-site/trunk/content/xdoc/commons-parent-pom.xml
Modified: commons/cms-site/trunk/content/xdoc/building.xml
URL:
http://svn.apache.org/viewvc/commons/cms-site/trunk/content/xdoc/building.xml?rev=1650631&r1=1650630&r2=1650631&view=diff
==============================================================================
--- commons/cms-site/trunk/content/xdoc/building.xml (original)
+++ commons/cms-site/trunk/content/xdoc/building.xml Fri Jan 9 19:06:27 2015
@@ -97,10 +97,12 @@
<p>
To compile and run a component's tests with JDK 1.5.
This assumes that the property JAVA_1_5_HOME has been defined in the
Maven <code>settings.xml</code>
+ or has been defined as an OS environment variable (if both are
defined, settings.xml takes precedence)
</p>
<source>mvn clean test -Pjava-1.5</source>
<p>
- To compile source and test files with Java 1.6 if settings.xml does
not contain the property definitions:
+ To compile source and test files with Java 1.6 if settings.xml does
not contain the property definitions
+ (note this overrides any definition in settings.xml):
</p>
<source>mvn clean compile test-compile -Pjava-1.6
-DJAVA_1_6_HOME=path-to-jdk-home</source>
</subsection>
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=1650631&r1=1650630&r2=1650631&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
19:06:27 2015
@@ -240,7 +240,7 @@
Using the <i>target</i> option ensures that the <code>.class</code>
file format is compatible with
the required Java version - but it does not prevent/catch the use of
methods/classes which were
introduced in later Java versions (because the build will use the
current Java libraries by default).
- The only way to ensure that components don't accidentally use
classes/methods from a later
+ One way to ensure that components don't accidentally use
classes/methods from a later
version of Java is to compile and test using actual Java versions.
</p>
<p>
@@ -259,7 +259,7 @@
</ul>
<p>
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.
+ 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.
Note: the Maven compiler plugin has
@@ -304,19 +304,24 @@
</settings>
]]></source>
<p>
- (Since the values are the locations of the Java installations on
your local machine,
- they are unlikely to change frequently and using the
<code>settings.xml</code> file will be
- the most convenient).
+ An alternative is to define the home directories as OS environment
variables.
+ For example:
+ <source>
+ JAVA_1_8_HOME=$(/usr/libexec/java_home -v 1.8) # MacOS only
+ JAVA_1_8_HOME=/path/to/java8/home # Other Unix OSes
+ export JAVA_1_8_HOME
+ </source>
</p>
<p>
- Once you have configured those properties you can, for example,
compile and test with Java 1.6 using the following command:
+ Once you have configured settings.xml or defined the OS variables
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)
+ You can also provide the appropriate property definition on the
command-line.
+ (However for frequent use it is easier to update the settings file or
ensure the OS defines the appropriate variables)
+ This overrides any property setting in the settings.xml file, which in
turn overrides the OS environment variable.
For example:
</p>
<source>