You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by sv...@ubs.com on 2000/10/13 09:32:42 UTC
including other build files
I'd like to be able to include/import other ant build files into my build.xml
For example I am thinking of defining generar properties in a general.xml
and the project specific things in the build.xml file as usual. in build.xml
I'd like to somehow include/import general.xml.
Maybe it should be XML's job to handle things like this but I am not aware that
there is any support for this from XML. XSL for example allows this using it's
own xsl:import xsl:include tags.
One could even go further and include just a part of it by specifiying an XPATH.
Implementation should be rather easy when using the xpathapi class coming with
xalan.
any comments ?
- Sven
Re: including other build files
Posted by Patrick Chanezon <ch...@netscape.com>.
Hi Sven,
on my project have the same need, ie accessing properties defined in a
generalbuild.xml from another build.xml.
We do this using scripting: in javascript we create an ant task on generalbuild.xml,
trigger the init task, then get a handle on the project object and get back the
properties we are interested in.
Then we set those properties in the current project object.
I didn't do it myself, but I put my colleague who did it in CC so that he can
correct me if I'm not accurate.
If I remember he had to modify the Project object. Not sure about this one.
P@
sven.ehrke@ubs.com wrote:
> I'd like to be able to include/import other ant build files into my build.xml
>
> For example I am thinking of defining generar properties in a general.xml
> and the project specific things in the build.xml file as usual. in build.xml
> I'd like to somehow include/import general.xml.
>
> Maybe it should be XML's job to handle things like this but I am not aware that
> there is any support for this from XML. XSL for example allows this using it's
> own xsl:import xsl:include tags.
>
> One could even go further and include just a part of it by specifiying an XPATH.
> Implementation should be rather easy when using the xpathapi class coming with
> xalan.
>
> any comments ?
>
> - Sven
--
Patrick Chanezon, iPlanet Market Maker- Portal/EServices Technical Lead
Netscape Communications Corp. - http://people.netscape.com/chanezon/
Opinions are my own.
"C@ in the H@
if you P@ the stomach
of a f@ C@,
it will look @ you,
and say I like th@"
Text by Dr. Seuss, Typesetting by Lawrence Steinman
The Junit task, suggestion to add "haltontimeout"
Posted by Peter Nordlund <pe...@lentus.se>.
Hi,
I suggest that an attribute "haltontimeout" is added to the
junit task
and to the nested junit tasks, test and batchtest.
The behaviour rigth now, if a test is not finished before
the timeout, is that the test silently is cancelled and
the build succeeds. (ant/2000-10-12)
At least for me, tests that are not finished in time are
regarded as failed tests.
Any comments?
/Regards,
Peter
Re: including other build files
Posted by Patrick Chanezon <ch...@netscape.com>.
Hi Sven,
on my project have the same need, ie accessing properties defined in a
generalbuild.xml from another build.xml.
We do this using scripting: in javascript we create an ant task on generalbuild.xml,
trigger the init task, then get a handle on the project object and get back the
properties we are interested in.
Then we set those properties in the current project object.
I didn't do it myself, but I put my colleague who did it in CC so that he can
correct me if I'm not accurate.
If I remember he had to modify the Project object. Not sure about this one.
P@
sven.ehrke@ubs.com wrote:
> I'd like to be able to include/import other ant build files into my build.xml
>
> For example I am thinking of defining generar properties in a general.xml
> and the project specific things in the build.xml file as usual. in build.xml
> I'd like to somehow include/import general.xml.
>
> Maybe it should be XML's job to handle things like this but I am not aware that
> there is any support for this from XML. XSL for example allows this using it's
> own xsl:import xsl:include tags.
>
> One could even go further and include just a part of it by specifiying an XPATH.
> Implementation should be rather easy when using the xpathapi class coming with
> xalan.
>
> any comments ?
>
> - Sven
--
Patrick Chanezon, iPlanet Market Maker- Portal/EServices Technical Lead
Netscape Communications Corp. - http://people.netscape.com/chanezon/
Opinions are my own.
"C@ in the H@
if you P@ the stomach
of a f@ C@,
it will look @ you,
and say I like th@"
Text by Dr. Seuss, Typesetting by Lawrence Steinman
Re: including other build files
Posted by Stefan Bodewig <bo...@bost.de>.
I've added an entry for this to the FAQ but unfortuately it hasn't
been approved yet (I have no influence on this).
Stefan
-------------------------------------------------------------------------
How do I include another fragment of a buildfile?
You can use XML's way of including external files and let the parser
do the job for Ant:
<?xml version="1.0"?>
<!DOCTYPE project [
<!ENTITY common SYSTEM "file:./common.xml">
]>
<project name="test" default="test" basedir=".">
<target name="setup">
...
</target>
&common;
...
</project>
will literally include the contents of common.xml where you've placed
the &common; entity.
In combination with a DTD this would look like this:
<!DOCTYPE project PUBLIC "-//ANT//DTD project//EN" "file:./ant.dtd" [
<!ENTITY include SYSTEM "file:./header.xml">
]>
Re: including other build files
Posted by Peter Nordlund <pe...@lentus.se>.
sven.ehrke@ubs.com wrote:
>
> I'd like to be able to include/import other ant build files into my build.xml
>
> For example I am thinking of defining generar properties in a general.xml
> and the project specific things in the build.xml file as usual. in build.xml
> I'd like to somehow include/import general.xml.
>
> Maybe it should be XML's job to handle things like this but I am not aware that
> there is any support for this from XML. XSL for example allows this using it's
> own xsl:import xsl:include tags.
>
> One could even go further and include just a part of it by specifiying an XPATH.
> Implementation should be rather easy when using the xpathapi class coming with
> xalan.
>
> any comments ?
>
> - Sven
I like your suggestion, I have thougth about the same thing.
Right now I solve my similar problems by having a common
file with properties that I include in several places
something like
<property file="${properties.common}" />
Then I also have an antfile with common targets that I call
with something like
<target name="newenvfiles" depends="">
<ant antfile="${buildfiles.dir}/build-common-targets.xml"
target="newenvfiles" />
</target>
This is NOT an elegant solution.
If the features you propose were available I think it would
be possible to write ant-code that is easier to understand
and maintain.
If anyone has something to propose that is better than my
current solution I am very interested in hearing from you!
/Regards,
Peter