ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Noack <rai...@noacks.net>
Subject Re: passing ant.java.version as an option
Date Mon, 05 Nov 2012 19:42:15 GMT
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 <javac> 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 <presetdef>.

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 <javac> 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 Orbacus, in fact ant 1.7.1 assigns
ant.java.version = 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.version 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 and 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 = 1.6 spreaded into the build file, it's
more flexible.
>
> So, that's my doubt: is there any other way, some trick,  to assign ant.java.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 interested in it,
I can publish the code.
>
> Thanks in advance,
> Virgilio Ravagli
>
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message