You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Stefano Mancarella <st...@caboto.it> on 2004/10/06 10:37:42 UTC

and s

Is there a way to reuse path definitions when using <import>, in a way 
similar to what you can do with targets?

I've a standard path defined in a common build file, which is good for 
almost all my projects.
When I need to change it I'm forced to redefine it completely, even when 
it would be better to extend it.

Example:

common-build.xml:

<path id="project.classpath">
     <pathelement location="${build.classes}"/>
     <fileset dir="${lib.dir}" includes="*.jar,*.zip"/>
</path>

build.xml:

<import file="common-build.xml"/>

<path id="project.classpath">
     <pathelement location="${build.classes}"/>
     <fileset dir="${lib.dir}" includes="*.jar,*.zip"/>
     <pathelement location="some.dir/some.file"/>
     <!-- .... -->
</path>

Is there a way to reuse the path elements specified in the common build 
file?


Re: and s

Posted by Stefano Mancarella <st...@caboto.it>.
Jacob Kjome wrote:
> I also tend to define a path that is empty, but
> referenced by one of the other standard paths.  That way, I can override that
> empty path and the pathelements will get included in the standard path by
> reference.
> Hopefully that's what you are looking for.

Yes it is. Thanks everyone who suggested it. :)


Re: and s

Posted by Jacob Kjome <ho...@visi.com>.
I've been specifying paths in an <xmlproperty> file which is loaded by the
common build file and used by other build files by importing the common build
file.  All build files use the same build structure so the paths are always
applicable to all builds.  I also tend to define a path that is empty, but
referenced by one of the other standard paths.  That way, I can override that
empty path and the pathelements will get included in the standard path by
reference.

Hopefully that's what you are looking for.

Jake

Quoting Stefano Mancarella <st...@caboto.it>:

> Is there a way to reuse path definitions when using <import>, in a way
> similar to what you can do with targets?
>
> I've a standard path defined in a common build file, which is good for
> almost all my projects.
> When I need to change it I'm forced to redefine it completely, even when
> it would be better to extend it.
>
> Example:
>
> common-build.xml:
>
> <path id="project.classpath">
>      <pathelement location="${build.classes}"/>
>      <fileset dir="${lib.dir}" includes="*.jar,*.zip"/>
> </path>
>
> build.xml:
>
> <import file="common-build.xml"/>
>
> <path id="project.classpath">
>      <pathelement location="${build.classes}"/>
>      <fileset dir="${lib.dir}" includes="*.jar,*.zip"/>
>      <pathelement location="some.dir/some.file"/>
>      <!-- .... -->
> </path>
>
> Is there a way to reuse the path elements specified in the common build
> file?
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org