A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Ant, Maven and Other Build Tools
Using multiple JDK for the same build script
Joined: Apr 09, 2007
Oct 16, 2008 15:37:00
I have JDK 1.3.1 on Unix and (JDK 1.4.2) on windows. I have build.xml file which should take the different JDK's based on the OS. I got the following solutions for it.
1. Declare <property> in
script like below and change it accodingly.
<property name="java.home" value="JDK_HOME_PATH"/>
2. I create a properties file for each env like below.
whenever i run the build.xml, i will comment the other properties file.
is there any other way i can do this without any modifications on the build file?
Thanks in advance.
Joined: May 14, 2008
Oct 16, 2008 19:30:00
Do this. In build.xml, have:
<property file="build.properties" /> <condition property="java.home" value="java.home.linux"> <os family="unix" /> </condition> <condition property="java.home" value="java.home.windows" > <os family="windows" /> </condition>
Then in build.properties have (using your locations, of course):
Then if you change or move the JDKs, you need update only the properties file.
P.S. Even this would work:
<property file="build.properties" /> <condition property="java.home" value="java.home.linux"> <os family="unix" /> </condition> <property name="java.home" value="java.home.windows">
In this, the Windows setting is the default.
[ October 16, 2008: Message edited by: Peter Johnson ]
JBoss In Action
I agree. Here's the link:
subject: Using multiple JDK for the same build script
Help needed with ANT
automatically echo project name for each task
can't get the logger to log everything
Ant Compilation slow
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014