You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Duane Fields <df...@caleonetworks.com> on 2000/11/06 23:40:06 UTC

"include" equivalnet in ant?

I'd like to be able to include a collection of targets from another
build.xml into an antfile, sorta like giving me a library of targets that I
can reuse between applications. I realize that I can use <ant> to call them,
but then I still have to create a target entry for each one in each new
build.xml.

--
D.K. Fields
Manager of Web Development
Caleo Networks, Inc.
dfields@caleonetworks.com
(512) 744-1012




Re: "include" equivalnet in ant?

Posted by Stefan Bodewig <bo...@bost.de>.
Nico Seessle <Ni...@epost.de> wrote:

> and that works. Could not get it to work with file: if I remember
> correctly :-)

this might even be the wrong direction (using the file: prefix I mean,
I need to experiment a little more and ask some guys closer to the XML
parsers ...)

> From: "William Ferguson" <wi...@verveinc.com>

>> I know this is getting off-topic wrt Ant, but including build
>> excerpts within other build files seem like a good idea to me. So
>> would you mind explaining how this works:
>>
>> <!DOCTYPE project [
>>     <!ENTITY common SYSTEM "file:./common.xml">
>> ]>
>>
>> cause I can't seem to get it to find the included (commom.xml)
>> file.

Make sure you are using Ant 1.2, even Ant 1.2rc1 had problems with
this if your build file was not in your current working directory
(i.e. the directory you've invoked Ant from).

Stefan

Re: "include" equivalnet in ant?

Posted by Nico Seessle <Ni...@epost.de>.
I'm currently using

--- cut ---
<?xml version="1.0"?>

<!DOCTYPE project [
  <!ENTITY buildFW SYSTEM "buildFW.inc">
  <!ENTITY buildHO SYSTEM "buildHO.inc">
%buildFW;
%buildHO;
]>

  <target name="performBuild">
    &buildFW;
    &buildHO;
[...]
--- cut ---

and that works. Could not get it to work with file: if I remember correctly
:-)

Nico

----- Original Message -----
From: "William Ferguson" <wi...@verveinc.com>
To: <an...@jakarta.apache.org>
Sent: Thursday, November 09, 2000 5:09 AM
Subject: RE: "include" equivalnet in ant?


> Stefan,
>
> I know this is getting off-topic wrt Ant, but including build excerpts
> within other build files seem like a good idea to me. So would you
> mind explaining how this works:
>
> <!DOCTYPE project [
>     <!ENTITY common SYSTEM "file:./common.xml">
> ]>
>
> cause I can't seem to get it to find the included (commom.xml) file.
>
> The 2 xml files are in the same directory.
>
>
> William
>



RE: "include" equivalnet in ant?

Posted by "J. Matthew Pryor" <jm...@verveinc.com>.
Sorry list, bad reply-to form
jmp
| j. matthew pryor <mailto:jmp@verveinc.com >
| verve, inc.      <http://www.verveinc.com/>


> -----Original Message-----
> From: J. Matthew Pryor [mailto:jmp@verveinc.com]
> Sent: Thursday, November 09, 2000 8:43 AM
> To: ant-user@jakarta.apache.org
> Subject: RE: "include" equivalnet in ant?
>
>
> Are you getting hard core with Ant ?
>
> Any neat tricks you've learned ?
>
> Cheers,
> Matthew
> | j. matthew pryor <mailto:jmp@verveinc.com >
> | verve, inc.      <http://www.verveinc.com/>
>
>
> > -----Original Message-----
> > From: William Ferguson [mailto:william@verveinc.com]
> > Sent: Wednesday, November 08, 2000 8:09 PM
> > To: ant-user@jakarta.apache.org
> > Subject: RE: "include" equivalnet in ant?
> >
> >
> > Stefan,
> >
> > I know this is getting off-topic wrt Ant, but including build excerpts
> > within other build files seem like a good idea to me. So would you
> > mind explaining how this works:
> >
> > <!DOCTYPE project [
> >     <!ENTITY common SYSTEM "file:./common.xml">
> > ]>
> >
> > cause I can't seem to get it to find the included (commom.xml) file.
> >
> > The 2 xml files are in the same directory.
> >
> >
> > William
> >
> >
> >
> > > -----Original Message-----
> > > From: Stefan Bodewig [mailto:bodewig@bost.de]
> > > Sent: Tuesday, 7 November 2000 19:45
> > > To: ant-user@jakarta.apache.org
> > > Subject: Re: "include" equivalnet in ant?
> > >
> > >
> > > >>>>> "DF" == Duane Fields <df...@caleonetworks.com> writes:
> > >
> > >  DF> I'd like to be able to include a collection of targets from
> > >  DF> another build.xml into an antfile,
> > >
> > > Copy of the FAQ entry I've created four weeks ago but that hasn't been
> > > released yet (*grmbl*) follows:
> > >
> > > -------------------
> > >
> > > 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: "include" equivalnet in ant?

Posted by "J. Matthew Pryor" <jm...@verveinc.com>.
Are you getting hard core with Ant ?

Any neat tricks you've learned ?

Cheers,
Matthew
| j. matthew pryor <mailto:jmp@verveinc.com >
| verve, inc.      <http://www.verveinc.com/>
 

> -----Original Message-----
> From: William Ferguson [mailto:william@verveinc.com]
> Sent: Wednesday, November 08, 2000 8:09 PM
> To: ant-user@jakarta.apache.org
> Subject: RE: "include" equivalnet in ant?
> 
> 
> Stefan,
> 
> I know this is getting off-topic wrt Ant, but including build excerpts 
> within other build files seem like a good idea to me. So would you 
> mind explaining how this works:
> 
> <!DOCTYPE project [
>     <!ENTITY common SYSTEM "file:./common.xml">
> ]>
> 
> cause I can't seem to get it to find the included (commom.xml) file. 
> 
> The 2 xml files are in the same directory.
> 
> 
> William
> 
> 
> 
> > -----Original Message-----
> > From: Stefan Bodewig [mailto:bodewig@bost.de]
> > Sent: Tuesday, 7 November 2000 19:45
> > To: ant-user@jakarta.apache.org
> > Subject: Re: "include" equivalnet in ant?
> > 
> > 
> > >>>>> "DF" == Duane Fields <df...@caleonetworks.com> writes:
> > 
> >  DF> I'd like to be able to include a collection of targets from
> >  DF> another build.xml into an antfile,
> > 
> > Copy of the FAQ entry I've created four weeks ago but that hasn't been
> > released yet (*grmbl*) follows:
> > 
> > -------------------
> > 
> > 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: "include" equivalnet in ant?

Posted by William Ferguson <wi...@verveinc.com>.
Stefan,

I know this is getting off-topic wrt Ant, but including build excerpts 
within other build files seem like a good idea to me. So would you 
mind explaining how this works:

<!DOCTYPE project [
    <!ENTITY common SYSTEM "file:./common.xml">
]>

cause I can't seem to get it to find the included (commom.xml) file. 

The 2 xml files are in the same directory.


William



> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@bost.de]
> Sent: Tuesday, 7 November 2000 19:45
> To: ant-user@jakarta.apache.org
> Subject: Re: "include" equivalnet in ant?
> 
> 
> >>>>> "DF" == Duane Fields <df...@caleonetworks.com> writes:
> 
>  DF> I'd like to be able to include a collection of targets from
>  DF> another build.xml into an antfile,
> 
> Copy of the FAQ entry I've created four weeks ago but that hasn't been
> released yet (*grmbl*) follows:
> 
> -------------------
> 
> 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: "include" equivalnet in ant?

Posted by Peter Donald <do...@apache.org>.
At 09:45  7/11/00 +0100, you wrote:
>>>>>> "DF" == Duane Fields <df...@caleonetworks.com> writes:
>
> DF> I'd like to be able to include a collection of targets from
> DF> another build.xml into an antfile,
>
>Copy of the FAQ entry I've created four weeks ago but that hasn't been
>released yet (*grmbl*) follows:

does anyone know if jyve allows multiple faq maintainers ? If so do you
think it would possible for Stefan to gain it ? ;)

Cheers,

Pete

*------------------------------------------------------*
| "Nearly all men can stand adversity, but if you want |
| to test a man's character, give him power."          |
|       -Abraham Lincoln                               |
*------------------------------------------------------*

Re: "include" equivalnet in ant?

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "DF" == Duane Fields <df...@caleonetworks.com> writes:

 DF> I'd like to be able to include a collection of targets from
 DF> another build.xml into an antfile,

Copy of the FAQ entry I've created four weeks ago but that hasn't been
released yet (*grmbl*) follows:

-------------------

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">
]>