Return-Path: X-Original-To: apmail-ant-user-archive@www.apache.org Delivered-To: apmail-ant-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1A2E3DF0E for ; Tue, 6 Nov 2012 08:07:16 +0000 (UTC) Received: (qmail 41260 invoked by uid 500); 6 Nov 2012 08:07:15 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 40838 invoked by uid 500); 6 Nov 2012 08:07:15 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 40810 invoked by uid 99); 6 Nov 2012 08:07:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Nov 2012 08:07:14 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [151.89.31.44] (HELO elcgepulmx11.elsag.it) (151.89.31.44) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Nov 2012 08:07:05 +0000 Received: from mxout.servizi.elsag.it (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 4BD457457B for ; Tue, 6 Nov 2012 09:06:42 +0100 (CET) Received: from grpgepwht001b.grptop.net (unknown [151.89.239.37]) by mxout.servizi.elsag.it (Postfix) with ESMTPS id 36F8C14003 for ; Tue, 6 Nov 2012 09:06:42 +0100 (CET) Received: from GRPGEPWMX002.grptop.net ([fe80::dc63:5fc6:30d4:f771]) by grpgepwht001b.grptop.net ([2002:9759:ef25::9759:ef25]) with mapi; Tue, 6 Nov 2012 09:06:42 +0100 From: Ravagli Virgilio To: Ant Users List Date: Tue, 6 Nov 2012 09:06:15 +0100 Subject: R: passing ant.java.version as an option Thread-Topic: passing ant.java.version as an option Thread-Index: Ac27jb4xov4B9wnxTDSvCVOs+zjU6QAZajdQ Message-ID: <07B42B18DF647A4A841D863174F52BFD04BB068514@GRPGEPWMX002.grptop.net> References: <07B42B18DF647A4A841D863174F52BFD04BAFC8529@GRPGEPWMX002.grptop.net> <50981697.70007@noacks.net> In-Reply-To: <50981697.70007@noacks.net> Accept-Language: it-IT Content-Language: it-IT X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: it-IT Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Thank you Rainer for your answer. I see your point. But I must say, I modified the ant sources just NOT to us= e -source; about -target, I don't want it, because Orbacus works fine under= Java 1.7, the problem is only at compile time, not at runtime, the target = api isn't a problem. I don't want to use old Java: my apps (Orbacus clients) are built on SWT, s= o I prefer working with newer Java version, moreover I use some features as= switch over strings, and they aren't available over old Java versions. Perhaps, your advice about is a good idea, I think I'll follow = it, instead of my -ajv option. Bye Virgilio -----Messaggio originale----- Da: Rainer Noack [mailto:rainer@noacks.net] Inviato: luned=EC 5 novembre 2012 20.42 A: user@ant.apache.org Oggetto: Re: passing ant.java.version as an option Hi Virgilio, what do you want the ant.java.version for? The property is defined to show the current java version and is working properly (if the ant version is newer than the java version ... - ant 1.7.1 is older than JDK 7) It's not a good idea to change that value. if you just want to set the attributes -source and -target by a property, you should use |ant.build.javac.source| <../javacprops.html#source> and/or |ant.build.javac.target which are recognised since ant 1.7.| <../javacprops.html#source> |You might also interested in using . However, to make sure that a class is runnable with a previous jvm, it must not only compiled with that target version but also has to be compatible with the target api. it's a good practice to compile it with the compiler of that jdk. See examples in manual on how to do that. Hope that helps Rainer | Am 05.11.2012 13:35, schrieb Ravagli Virgilio: > Hi everybody. > I expose my question. > I had to build JOB-4.3.4, Orbacus Java version, and I couldn't use JDK1.7= because of errors; everything would be fine using ant 1.7.1 to build Orbac= us, in fact ant 1.7.1 assigns ant.java.version =3D 1.6 even if my JDK1.7 is= 1.7. > > Trying ant 1.8.4, I had the same mistakes, because this time ant.java.ver= sion was 1.7 (the same as the installed JDK). > > As a matter of fact, I prefer using ant 1.8.4, so I thought to modify it:= I downloaded the source dist and modified two classes, JavaEnvUtils.java a= nd its caller Main.java, introducing "an option of mine", ajv (acronym that= stands for ant java version) followed by the desired Java version. > > I built my ant 1.8.4, then compiled with -ajv 1.6 and everything was good= . > > Imho it's a better solution than using source =3D 1.6 spreaded into the b= uild file, it's more flexible. > > So, that's my doubt: is there any other way, some trick, to assign ant.j= ava.version instead of letting it assigned by the ant code ? > > The other way round, if someone thinks my choice is good, or if he's inte= rested in it, I can publish the code. > > Thanks in advance, > Virgilio Ravagli > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org