Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0A15A10A69 for ; Fri, 9 Jan 2015 19:06:27 +0000 (UTC) Received: (qmail 30986 invoked by uid 500); 9 Jan 2015 19:06:28 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 30922 invoked by uid 500); 9 Jan 2015 19:06:27 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 30912 invoked by uid 99); 9 Jan 2015 19:06:27 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Jan 2015 19:06:27 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 8D8B9AC010E; Fri, 9 Jan 2015 19:06:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1650631 - in /commons/cms-site/trunk/content/xdoc: building.xml commons-parent-pom.xml Date: Fri, 09 Jan 2015 19:06:27 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150109190627.8D8B9AC010E@hades.apache.org> 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 @@

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 settings.xml + or has been defined as an OS environment variable (if both are defined, settings.xml takes precedence)

mvn clean test -Pjava-1.5

- 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):

mvn clean compile test-compile -Pjava-1.6 -DJAVA_1_6_HOME=path-to-jdk-home 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 target option ensures that the .class 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.

@@ -259,7 +259,7 @@

In order for these profiles to work, you need to configure the relevant JAVA_1_N_HOME - properties in your settings.xml file. + properties in your settings.xml file. [There is no need to configure properties for profiles you don't need.] Each property should be set to the directory where the relevant version of the JDK is installed. Note: the Maven compiler plugin has @@ -304,19 +304,24 @@ ]]>

- (Since the values are the locations of the Java installations on your local machine, - they are unlikely to change frequently and using the settings.xml file will be - the most convenient). + An alternative is to define the home directories as OS environment variables. + For example: + + 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 +

- 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:

mvn clean test -Pjava-1.6

- If you don't want to update the settings.xml 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: