ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Stevens" <insomniacpeng...@googlemail.com>
Subject Re: Build in multiple java versions using Ant
Date Wed, 22 Oct 2008 13:24:01 GMT
2008/10/20 scuzzie <shane.marsden@gmail.com>:
> Hi,
>
> I have a project written in NetBeans 6.1 that I need to be able to compile
> on demand using any JDK version from 1.4.2, on a machine that does not have
> NetBeans installed (but does have Ant of course). The app compiles under
> 1.4.2 and up using the Ant xml files generated by NetBeans. At the moment,
> the options are 1.4.2/1.5/1.6 as they are the JDKs that are installed on the
> machine. The application uses Swing so has a couple of dependant jars.
>
> Modifying the xml build files is not an option.

So you can't put anything in the build.xml to override the various
-pre & -post "hook" targets the netbeans project scripts provide?
Pity, that rules out putting something in -pre-init to read an extra
property file from a path that only exists on the server, before
-init-project reads the project.properties file.

Have you got build.xml and nbproject/* (but not nbproject/private/*)
under source control?  Could you do a one-off create of a
nbproject/private/private.properties on the build machine (ignored by
the VCS)?  That gets read before project.properties so you can
override settings in there.

> Specifying a properties file
> from the Ant command-line is fine, and I have had to do this anyway (as well
> as copying the swing and NetBeans copylibs jars to the machine). The file is
> autogenerated and is created automatically before calling Ant.

Hmm... other than the autogeneration, this sounds kind of like what we
do with our CruiseControl builds - the CC "master" build scripts do a
<property file="private.properties"/> before running the build.xml in
the project directory with <ant dir="${project.basedir}"
target="dist"/>  private.properties includes a setting for
user.properties.file to point it at a shared copy of build.properties
(copied and modified from a machine with a full Netbeans
installation), containing all the platforms.* and libs.* settings.  We
also use it to specify the appserver-specific j2ee.platform.classpath
etc., basically everything that would normally have been in
nbproject/private/private.properties on a user's checked out copy.

> Are there properties I can add to my properties file to specify which
> version of the SDK to compile with? Any other suggestions?

If you have platforms definitions for each of the JDK paths (like you
get in $HOME/.netbeans/build.properties when you add multiple JDKs in
the Java Platform Manager), just override platform.active as
appropriate, some time before project.properties is read.  Possibly
javac.source & javac.target too, though assuming you have one version
of the source to compile on all the JDKs, you should probably have
javac.source set to the lowest JDK version already.

Just look through project.properties.  Ant properties being
unchangeable, so long as you set them somehow before this file is read
they'll override the ones from your project.

> Using Windows.

You have my deepest sympathies ;-)


Andy.
-- 
http://pseudoq.sourceforge.net/  Open source java Sudoku application

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message