tags:

views:

149

answers:

3

I have an Eclipse project that I'm attempting to set up to build both with Eclipse and externally with Ant. It seems like a good way to do this is to have Eclipse generate a build.xml file that I can then use with ant.

I'd like to set it up so the build.xml can be regenerated from Eclipse whenever the need arises, which means no hand-editing the build.xml file. But Eclipse writes one entry in there that has a hard-coded path to a directory on my computer, which makes it unsuitable for checking in to a source repository.

Specifically it's this entry that's the trouble:

<property name="ECLIPSE_HOME" value="D:/Eclipse/Eclipse Galileo (3.5) SR1"/>

Is there some way to have Eclipse not output this line, or to make it a relative reference or something that makes sense to check in?

+1  A: 

Usually when you are checking build files into a repository you keep the variables that may be unique for each user into a separate file, ex: build.properties, that each user can modify and not commit it.

You import that file by using the following syntax:

<property file="./build.properties" />
Bobby
+1  A: 

Alternatively, due to Ant's immutable properties, you can override the value of ECLIPSE_HOME on the command line:

ant -DECLIPSE_HOME=c:/Eclipse/MyEclipseVersion build
flicken
A: 

You can better access environment variables from ant:

<property environment="env"/>

<target name="deploy-dev" depends="war-dev">
<copy file="${deploy}/" tofile="${env.TOMCAT_HOME}/webapps/" />
</target>
David García González