Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4D8569092 for ; Thu, 14 Jun 2012 21:24:39 +0000 (UTC) Received: (qmail 59851 invoked by uid 500); 14 Jun 2012 21:24:38 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 59763 invoked by uid 500); 14 Jun 2012 21:24:38 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 59755 invoked by uid 99); 14 Jun 2012 21:24:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jun 2012 21:24:38 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [193.74.71.26] (HELO hel.is.scarlet.be) (193.74.71.26) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jun 2012 21:24:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scarlet.be; s=scarlet; t=1339709051; bh=f7O4rpQLgfsvLyCNbba1tGa2xdIzVeo5Afr0MDf+0AE=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Transfer-Encoding:In-Reply-To; b=bt7e7v9u9WXzqJ4mtt8apCksiWPJrfUNEnfoBtSUft/G6EpSf3P1aACvs6H5ePWGL nVAY2Pp3uVrNWPkCUhTMn3iq2X9m7LUnCfGPylEnkXCgnFSPYdh2kwIE43A8QVolAB SiFGH90Zn1WddQCRhT2tGs0X83O/+c+H8NmAhn1w= Received: from mail.harfang.homelinux.org (ip-213-49-251-141.dsl.scarlet.be [213.49.251.141]) by hel.is.scarlet.be (8.14.5/8.14.5) with ESMTP id q5ELOA32023982 for ; Thu, 14 Jun 2012 23:24:11 +0200 X-Scarlet: d=1339709051 c=213.49.251.141 Received: from localhost (mail.harfang.homelinux.org [192.168.20.11]) by mail.harfang.homelinux.org (Postfix) with ESMTP id 3558D61BBB for ; Thu, 14 Jun 2012 23:24:10 +0200 (CEST) Received: from mail.harfang.homelinux.org ([192.168.20.11]) by localhost (mail.harfang.homelinux.org [192.168.20.11]) (amavisd-new, port 10024) with ESMTP id ZQIBTUcznTkw for ; Thu, 14 Jun 2012 23:24:08 +0200 (CEST) Received: from dusk.harfang.homelinux.org (mail.harfang.homelinux.org [192.168.20.11]) by mail.harfang.homelinux.org (Postfix) with ESMTP id A263461831 for ; Thu, 14 Jun 2012 23:24:08 +0200 (CEST) Received: from eran by dusk.harfang.homelinux.org with local (Exim 4.77) (envelope-from ) id 1SfHWR-0001wD-QR for dev@commons.apache.org; Thu, 14 Jun 2012 23:24:07 +0200 Date: Thu, 14 Jun 2012 23:24:07 +0200 From: Gilles Sadowski To: dev@commons.apache.org Subject: Re: [Math] How to select a specific JDK ? Message-ID: <20120614212407.GE10938@dusk.harfang.homelinux.org> Mail-Followup-To: dev@commons.apache.org References: <20120613115648.GV32074@dusk.harfang.homelinux.org> <20120613124358.GX32074@dusk.harfang.homelinux.org> <20120613144734.GY32074@dusk.harfang.homelinux.org> <20120613173032.GE32074@dusk.harfang.homelinux.org> <20120614011502.GC10938@dusk.harfang.homelinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: Tiny Tux X-PGP-Key-Fingerprint: 53B9 972E C2E6 B93C BEAD 7092 09E6 AF46 51D0 5641 User-Agent: Mutt/1.5.21 (2010-09-15) X-DCC-scarlet.be-Metrics: hel 20001; Body=1 Fuz1=1 Fuz2=1 X-Virus-Scanned: clamav-milter 0.97.1-exp at hel X-Virus-Status: Clean X-Virus-Checked: Checked by ClamAV on apache.org On Thu, Jun 14, 2012 at 05:31:23PM +0100, sebb wrote: > On 14 June 2012 02:15, Gilles Sadowski wrote: > > Hello. > > > >> > [...] > > > > The following: > > > >> >> > I should be able to do all combinations, i.e.: > >> >> > �1. Compile with javac 1.6 and run with java 1.6 > >> >> > �2. Compile with javac 1.7 and run with java 1.7 > > > > is achieved by those respective commands: > > > > �$ JAVA_1_6_HOME=/usr/lib/jvm/java-6-sun mvn -X -Pjava-1.6 clean test > > �$ JAVA_1_7_HOME=/usr/lib/jvm/java-7-openjdk-amd64 mvn -X -Pjava-1.7 clean test > > > > IIUC: > > �JAVA_x_y_HOME is used to locate the "javac" executable > > Sort of. > > > �-Pjava-x.y selects the language level > > -P selects the profile, which uses the relevant JAVA_1_n_HOME variable > to locate the relevant Java installation. > These variable were introduced specifically to support the java-x.y profiles. The profile also sets "commons.compiler.compilerVersion", and I inferred that this would define which version of the language is accepted by the compiler. Is that correct? > > > �JAVA_HOME has no effect > > > > This, however, > > > >> >> > �3. Compile with javac 1.6 and run with java 1.7 > > > > is not so easy. �To run the tests with 1.7, one needs > > > > �$ JAVA_1_6_HOME=/usr/lib/jvm/java-6-sun mvn -Dcommons.surefire.java=/usr/lib/jvm/java-7-openjdk-amd64/bin/java -X -Pjava-1.6 clean test > > >> > [...] > > > > Much to my surprise, this > > > > �$ JAVA_1_7_HOME=/usr/lib/jvm/java-7-openjdk-amd64 mvn -Dcommons.surefire.java=/usr/lib/jvm/java-6-sun/bin/java -X -Pjava-1.7 clean test > > > > (i.e. using java 1.6 to run classes compiled with javac 1.7) also works! Is > > that expected? [I thought I'd get the "incompatible major.minor version" > > exception.] > > Unless you are using an updated version of the parent pom, the profile > java-1.7 does not exist - this should report an error, but it might > get lost in the -X output - so the compilation will use your default > java compiler. Excerpt (with line numbers) of "commons-parent-24.pom": --- 858 859 java-1.7 860 861 true 862 1.7 863 ${JAVA_1_7_HOME}/bin/javac 864 ${JAVA_1_7_HOME}/bin/java 865 866 --- Regards, Gilles --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org