You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Rez <po...@hotmail.com> on 2008/12/17 00:38:33 UTC

calling a build file from another

Hi
Not sure why I got a mailer daemon posting to Ant user group?!
 
Is it possible to call one ant file (build.xml) from another project's buil=d.xml?currently I build projects A & B. ProjB produces a jar file needed by A=2C=so I build B first=2C ant file copies the jar file into A\lib folder then =I switch to projA and build the war file. I would like to cd into projA an=d call the ant file in projB=2C have it copy the file over and resume build=ing projA.Do I just load the projB's build file as a property file in projA and make =antCalls to projB's targets?Thanks_________________________________________________________________
_________________________________________________________________
Send e-mail faster without improving your typing skills.
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008

Re: Tokenizing Property Files

Posted by David Weintraub <qa...@gmail.com>.
If all of these files agree EXCEPT for these specific values, then you
should use filtering in your build.xml when you copy these files to
build your artifacts.

This (fortunately) is pretty simple to do:

   <copy todir="${deploy.dir}"
        overwrite="true"
        verbose="${copy.verbose.flag}">
        <fileset dir="${resouce.dir}">
             <include name="**/*.template"/>
        </fileset>
        <mapper type="glob"
             from="*.template" to="*"/>
        <filterset begintoken="@" endtoken="@">
            <filtersfile file="${deploy.properties.file}"/>
        </filterset>
    </copy>

(In our situation, the files that are filtered have a "*.template"
suffix on them, thus we need the <mapper> to remove this suffix from
our files).

This way, all of the values can be stored in separate
deploy.properties files which you can specify on the command line.

The advantage is quite simple: You only have to maintain a single set
of files. Imagine if one of these XML files changed. Right now, you
would have to duplicate this one change in all environments. This way,
you only have to modify the template file itself.

Plus, if you create another environment, you only have to create a new
properties file for that environment and not duplicate everything.
Also, if something changes (like a password), in your system, you have
to comb through all the files to make sure it wasn't specified in more
than one place. Using filtering, you only have to change it in the
deploy properties file for that environment.

And, you can have a common deploy properties file and individual
deploy properties file. That way, something that is the same value in
all of those environments is changed (such as your test server IP
address), you only have to modify the common deploy properties and not
the individual ones.

On Wed, Jun 24, 2009 at 7:10 PM, Rez P<po...@hotmail.com> wrote:
>
> What's the right way to use token replacement for my Ant builds?
>
> We have a few files common to all environments and currently maintain a set of these files per environment -- xml files, property files, and a web.xml per environment not identical.  The files contain mostly static information except such variables as the urls or db connection and usrid/pw which change per environment.  Currently we retain a few sets of these files per environment, e.g. db.connections.qa, db.connections.uat, web.xml.qa, web.xml.dev, etc & their corresponding ant value in build.xml would be db.connections.${env}, where env equals qa, dev,  etc, and then I pass the qa or uat  parameters to the build.xml during the Ant compile process as -Denv=qa and generate a war file with their corresponding property files and web.xml per environment.
>
> Would it be better, for the sake of automation consistency or cleanliness, for files whose values do vary per environment, to come up with one base or master file, such as db.connections or web.xml, and some of the values in each file which change for each environment to have token values @UID@ or @PASSWORD@, etc. And each master file has 3 or 4 environment related property files holding the actual values?
>
> What's the best way to address this issue?
>
> Thanks
>
>
> _________________________________________________________________
> Hotmail® has ever-growing storage! Don’t worry about storage limits.
> http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009



-- 
David Weintraub
qazwart@gmail.com

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


Tokenizing Property Files

Posted by Rez P <po...@hotmail.com>.
What's the right way to use token replacement for my Ant builds?
 
We have a few files common to all environments and currently maintain a set of these files per environment -- xml files, property files, and a web.xml per environment not identical.  The files contain mostly static information except such variables as the urls or db connection and usrid/pw which change per environment.  Currently we retain a few sets of these files per environment, e.g. db.connections.qa, db.connections.uat, web.xml.qa, web.xml.dev, etc & their corresponding ant value in build.xml would be db.connections.${env}, where env equals qa, dev,  etc, and then I pass the qa or uat  parameters to the build.xml during the Ant compile process as -Denv=qa and generate a war file with their corresponding property files and web.xml per environment.
 
Would it be better, for the sake of automation consistency or cleanliness, for files whose values do vary per environment, to come up with one base or master file, such as db.connections or web.xml, and some of the values in each file which change for each environment to have token values @UID@ or @PASSWORD@, etc. And each master file has 3 or 4 environment related property files holding the actual values?
 
What's the best way to address this issue?
 
Thanks
 
 
_________________________________________________________________
Hotmail® has ever-growing storage! Don’t worry about storage limits.
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009

Re: calling a build file from another

Posted by Shaaf Syed M <sh...@gmail.com>.
My bad, understood it incorrectly.

Thanks.

On Wed, Dec 17, 2008 at 10:33 AM, Ramu Sethu <sr...@yahoo.co.in> wrote:

> I believe antcall is for calling another target in the same build
>
> On Wed, Dec 17, 2008 at 2:26 PM, Shaaf Syed M <sh...@gmail.com> wrote:
>
> > this might be of help too.
> >
> > http://ant.apache.org/manual/CoreTasks/antcall.html
> >
> >
> >
> > On Wed, Dec 17, 2008 at 12:38 AM, Rez <po...@hotmail.com> wrote:
> >
> > >
> > > Hi
> > > Not sure why I got a mailer daemon posting to Ant user group?!
> > >
> > > Is it possible to call one ant file (build.xml) from another project's
> > > buil=d.xml?currently I build projects A & B. ProjB produces a jar file
> > > needed by A=2C=so I build B first=2C ant file copies the jar file into
> > A\lib
> > > folder then =I switch to projA and build the war file. I would like to
> cd
> > > into projA an=d call the ant file in projB=2C have it copy the file
> over
> > and
> > > resume build=ing projA.Do I just load the projB's build file as a
> > property
> > > file in projA and make =antCalls to projB's
> > >
> >
> targets?Thanks_________________________________________________________________
> > > _________________________________________________________________
> > > Send e-mail faster without improving your typing skills.
> > >
> > >
> >
> http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008
> > >
> >
>
>
>
> --
> Thank you
> Ramu S
>
>  If A is success in life, then A equals x plus y plus z. Work is x; y is
> play; and z is keeping your mouth shut.
> - Albert Einstein
>

Re: calling a build file from another

Posted by Ramu Sethu <sr...@yahoo.co.in>.
I believe antcall is for calling another target in the same build

On Wed, Dec 17, 2008 at 2:26 PM, Shaaf Syed M <sh...@gmail.com> wrote:

> this might be of help too.
>
> http://ant.apache.org/manual/CoreTasks/antcall.html
>
>
>
> On Wed, Dec 17, 2008 at 12:38 AM, Rez <po...@hotmail.com> wrote:
>
> >
> > Hi
> > Not sure why I got a mailer daemon posting to Ant user group?!
> >
> > Is it possible to call one ant file (build.xml) from another project's
> > buil=d.xml?currently I build projects A & B. ProjB produces a jar file
> > needed by A=2C=so I build B first=2C ant file copies the jar file into
> A\lib
> > folder then =I switch to projA and build the war file. I would like to cd
> > into projA an=d call the ant file in projB=2C have it copy the file over
> and
> > resume build=ing projA.Do I just load the projB's build file as a
> property
> > file in projA and make =antCalls to projB's
> >
> targets?Thanks_________________________________________________________________
> > _________________________________________________________________
> > Send e-mail faster without improving your typing skills.
> >
> >
> http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008
> >
>



-- 
Thank you
Ramu S

 If A is success in life, then A equals x plus y plus z. Work is x; y is
play; and z is keeping your mouth shut.
- Albert Einstein

Re: calling a build file from another

Posted by Shaaf Syed M <sh...@gmail.com>.
this might be of help too.

http://ant.apache.org/manual/CoreTasks/antcall.html



On Wed, Dec 17, 2008 at 12:38 AM, Rez <po...@hotmail.com> wrote:

>
> Hi
> Not sure why I got a mailer daemon posting to Ant user group?!
>
> Is it possible to call one ant file (build.xml) from another project's
> buil=d.xml?currently I build projects A & B. ProjB produces a jar file
> needed by A=2C=so I build B first=2C ant file copies the jar file into A\lib
> folder then =I switch to projA and build the war file. I would like to cd
> into projA an=d call the ant file in projB=2C have it copy the file over and
> resume build=ing projA.Do I just load the projB's build file as a property
> file in projA and make =antCalls to projB's
> targets?Thanks_________________________________________________________________
> _________________________________________________________________
> Send e-mail faster without improving your typing skills.
>
> http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008
>

Re: calling a build file from another

Posted by glenn opdycke-hansen <gl...@gmail.com>.
Subant is another option.
http://ant.apache.org/manual/CoreTasks/subant.html

I just did a restructure of an Ant script and did some research in this.  I
ended up splitting up the large ant script and used import task
--glenn

RE: calling a build file from another

Posted by Rez <po...@hotmail.com>.
Thanks, I didn't even given a 2nd thought on clicking on that command, thinking it's supposed to be used at the command line only. Duh.  That's what I needed, thanks again.> Date: Wed, 17 Dec 2008 12:05:52 +0530> From: sramhu@yahoo.co.in> To: user@ant.apache.org> Subject: Re: calling a build file from another> > Yes use ant task> > see http://ant.apache.org/manual/CoreTasks/ant.html for more info> > > On Wed, Dec 17, 2008 at 5:08 AM, Rez <po...@hotmail.com> wrote:> > >> > Hi> > Not sure why I got a mailer daemon posting to Ant user group?!> >> > Is it possible to call one ant file (build.xml) from another project's> > buil=d.xml?currently I build projects A & B. ProjB produces a jar file> > needed by A=2C=so I build B first=2C ant file copies the jar file into A\lib> > folder then =I switch to projA and build the war file. I would like to cd> > into projA an=d call the ant file in projB=2C have it copy the file over and> > resume build=ing projA.Do I just load the projB's build file as a property> > file in projA and make =antCalls to projB's> > targets?Thanks_________________________________________________________________> > _________________________________________________________________> > Send e-mail faster without improving your typing skills.> >> > http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008> >> > > > -- > Thank you> Ramu S> > If A is success in life, then A equals x plus y plus z. Work is x; y is> play; and z is keeping your mouth shut.> - Albert Einstein
_________________________________________________________________
Send e-mail anywhere. No map, no compass.
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_anywhere_122008

Re: calling a build file from another

Posted by Ramu Sethu <sr...@yahoo.co.in>.
Yes use ant task

see http://ant.apache.org/manual/CoreTasks/ant.html for more info


On Wed, Dec 17, 2008 at 5:08 AM, Rez <po...@hotmail.com> wrote:

>
> Hi
> Not sure why I got a mailer daemon posting to Ant user group?!
>
> Is it possible to call one ant file (build.xml) from another project's
> buil=d.xml?currently I build projects A & B. ProjB produces a jar file
> needed by A=2C=so I build B first=2C ant file copies the jar file into A\lib
> folder then =I switch to projA and build the war file. I would like to cd
> into projA an=d call the ant file in projB=2C have it copy the file over and
> resume build=ing projA.Do I just load the projB's build file as a property
> file in projA and make =antCalls to projB's
> targets?Thanks_________________________________________________________________
> _________________________________________________________________
> Send e-mail faster without improving your typing skills.
>
> http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008
>



-- 
Thank you
Ramu S

 If A is success in life, then A equals x plus y plus z. Work is x; y is
play; and z is keeping your mouth shut.
- Albert Einstein