This worked in Ant 1.7.1 but no longer works in Ant 1.8.1. Is this a bug or is there a new and/or better way to achieve what I'm trying to do?
The Project consists of 2 components, each component has it's own build file and properties file, there is also a top level build file and properties file for common ant targets and properties. It is laid out like so:
- /project/
- component-a/
- build.properties
- build.xml
- component-b/
- build.properties
- build.xml
- build.properties
- build.xml
- component-a/
/project/build.properties:
common.root.dir=/project
/project/build.xml:
<project name="common">
<dirname file="${ant.file.common}" property="common.base.dir"/>
<loadproperties srcfile="${common.base.dir}/build.properties"/>
</project>
/project/component-b/build.properties:
dist.dir=${common.root.dir}/component-b/dist
/project/component-b/build.xml:
<project name="component-b">
<dirname property="component.b.base.dir" file="${ant.file.component-b}"/>
<import file="${component.b.base.dir}/../build.xml"/>
<loadproperties srcfile="${component.b.base.dir}/build.properties"/>
</project>
/project/component-a/build.properties:
dist.dir=${common.root.dir}/component-a/dist
/project/component-a/build.xml:
<project name="component-a">
<dirname property="component.a.base.dir" file="${ant.file.component-a}"/>
<property name="project.root.dir" location="${component.a.base.dir}/.."/>
<import file="${project.root.dir}/build.xml"/>
<loadproperties srcfile="${component.a.base.dir}/build.properties"/>
<loadproperties srcfile="${project.root.dir}/component-b/build.properties" prefix="component.b"/>
<target name="print.unresolved.property">
<echo>${component.b.dist.dir}</echo>
</target>
</project>
To see the error run: ant -f /project/component-a/build.xml print.unresolved.property
If using Ant 1.8.1 the output will be:
print.unresolved.property:
[echo] ${common.root.dir}/component-b/dist
Why is common.root.dir not resolving to /project?