schmmd
schmmd

Reputation: 19468

Path relative to include in ant

I have an ant build system. I have some common build files (common.xml) that other build files (such as foo) import. Often times, I would like to include/refer to a file from the common build file. However, these paths end up being relative to project foo's build.xml.

Is it possible to have foo's build.xml import common.xml (which is in ../) but still have common.xml refer to files in common.xml's directory?

In other words, in common.xml I want to write paths relative to common.xml's directory, not foo's directory.

Upvotes: 1

Views: 1330

Answers (1)

matt
matt

Reputation: 79743

Take a look at the section "Resolving files against the imported file" in the import task docs.

Basically you need to get the path of the common.xml file using the dirname task, and use this to construct the path to the relative file.

Upvotes: 1

Related Questions