You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Thorselius Göran <go...@scania.com> on 2003/03/04 11:00:11 UTC

Relative / absolute path

Hi all.

I have a file, antPropterty.xml that I want to include
to my build.xml file.

I tired this:

<!DOCTYPE project [
    <!ENTITY include SYSTEM "\dir_1\dir_2\antProperties.xml">
]>


<project name="StructureConverter" default="main" basedir=".">	
	&include;

	<target name="main"....
	</target>
</project>

The problem is that ant tries to find the antProperties.xml in the same
dir as my build.xml - file , but the file is actually located somewhere
else.

<drive>:\dir_1\dir_2\antProperties.xml

<drive>:\dir_a\dir_b\build.xml

Ant says: 
Cannot find \dir_a\dir_b\dir_1\dir_2\antProperties.xml

How can I fix this ?

Re: Relative / absolute path

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Thorselius Göran" <go...@scania.com>
To: "'Ant Users List'" <us...@ant.apache.org>
Sent: Tuesday, March 04, 2003 02:00
Subject: Relative / absolute path


> Hi all.
>
> I have a file, antPropterty.xml that I want to include
> to my build.xml file.
>
>
> The problem is that ant tries to find the antProperties.xml in the same
> dir as my build.xml - file , but the file is actually located somewhere
> else.
>
> <drive>:\dir_1\dir_2\antProperties.xml
>
> <drive>:\dir_a\dir_b\build.xml
>
> Ant says:
> Cannot find \dir_a\dir_b\dir_1\dir_2\antProperties.xml
>
> How can I fix this ?

you can use relative references "../../something" or maybe an absolute
file:/// at the begininnign of the inclusion .

ant1.6 has an <import> task that is meant to simplify a lot, because now Ant
is doing the import, not the XML parser.


Re: Relative / absolute path

Posted by Erik Price <ep...@ptc.com>.

Thorselius Göran wrote:

[...]

> <!DOCTYPE project [
>     <!ENTITY include SYSTEM "\dir_1\dir_2\antProperties.xml">
> ]>

[...]

> Ant says: 
> Cannot find \dir_a\dir_b\dir_1\dir_2\antProperties.xml
> 
> How can I fix this ?

Try using crossplatform-style file hierarchy delimiters -- in other 
words, forward-slashes (even if you're on Win32).  Something like this 
should work:

<!ENTITY include SYSTEM "../dir_1/dir_2/antProperties.xml">

Which assumes that you have a file hierarchy like this:

/above_dir_1
   /dir_1
     /dir_2
       antProperties.xml
   /some_other_dir
     build.xml

Obviously custom-taylor to your own filesystem setup.



Erik