How to set Ant properties based on variables in Eclipse?

后端 未结 5 1942
我在风中等你
我在风中等你 2021-02-13 23:00

I have a common problem and there are probably countless ways to solve it. I\'m looking for an elegant, simple solution to this typical scenario:

I have a project in Ec

5条回答
  •  遥遥无期
    2021-02-14 00:03

    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).

提交回复
热议问题