How to set Ant properties based on variables in Eclipse?

I think what I'm looking for is to add the following to the build. Properties file.

I think what I'm looking for is to add the following to the build. Properties file: project. Root = ${basedir} alternatively, I can just use the basedir property whenever project.

Root is needed. I happened to be looking at the source code for ivy. Properties and I saw the basedir property being used.

I just tested and verified that this property works on different machines both from inside eclipse and from the command line as well as when making a call to ant from a different directory such as: ant -f /path/to/eclipse/workspace/projectName/build. Xml When I get a minute, I will verify that this also works when importing the property file in different locations (such as inside src/main/resources/config/ivy/ivysettings. Xml).

Thanks, helped me too. – Andre Bossard Apr 6 '11 at 13:57.

For my project archieve. ProjectName |_ ant |_ ant. Xml Your case can just simply change the ant xml file, the Then I can get the project root using variable of e.g.

If you need more than the trivial basedir stuff = Ant4Eclipse - a bunch of ant tasks for access to eclipse configurations from within ant - may help you. Just use it as is or grep the code and pick the relevant parts..

Thanks, I'll look into this. It sounds useful. – gmale Jun 13 '11 at 15:23.

See Window -> Preferences -> Ant -> Runtime -> Properties to define custom ant properties that should be available to any ant script invoked from Eclipse. The simply set the same property manually when invoking script from command-line. Your build.

Properties file can exist wherever you like. Use normal Ant facilities to import it into your script.

Thank you for taking time to respond. Unfortunately, your response doesn't directly address any of the issues above because 1) the ant runtime properties do not contain an entry for the project root path. I'm guessing I can add ${workspace_loc} or something similar to the properties list but this would not work outside eclipse.2) setting a property manually when invoking the script from the command line does not scale well to a team environment.

3) Lastly, when the properties file is imported the relative paths can change so absolute paths are required, which is a problem. – gmale Jan 11 '11 at 18:12.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions