You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Chris Reeves <CR...@medfusion.net> on 2003/02/11 22:43:34 UTC

Parsing task

I've been searching for a task that would do a little parsing for
me...it seems I've seen this sort of thing before, but that may have
been a dream...

I have two ant xml files for my project - one builds the project
(build.xml), one runs the executable (run.xml) produced by the build;
this second file is simply bundled with the distribution.

It works great - except that the properties in the run.xml must be
changed on a per-environment basis (dev, stage, prod). And I only need
to change a couple of lines.

So, I'd like to have something like:

<!-- ========== mail properties ========== -->

<dev>
<property name="to.address"
value="devuser@nowhere.com"/>		
<property name="from.address"
value="devappthingy@nowhere.com"/>
<property name="smtp.server"
value="myserver.nowhere.com"/>
</dev>

<stage>
<property name="to.address"
value="devuser@nowhere.com"/>		
<property name="from.address"
value="stageappthingy@nowhere.com"/>
<property name="smtp.server"
value="myserver.nowhere.com"/>
</stage>

<prod>
<property name="to.address"
value="produser1@nowhere.com, produser1@nowhere.com"/>		
<property name="from.address"
value="appthingy@nowhere.com"/>
<property name="smtp.server"
value="myserver.prod.nowhere.com"/>
</prod>

The end product should contain only the xml relevant for the environment
it was built for.

Also, I know I could run ant with a specific target that sets these
properties, but that means that all properties for all env's would be on
each system.

I suppose I could use xslt to alter the file, but it seems there should
be something easier. I scoured the Hatchet/Loughran book, but didn't
find what I was looking for. Any ideas?

Chris

----------------------------------------
Chris Reeves
Senior Software Developer
Medfusion, Inc.
creeves@medfusion.net
----------------------------------------

RE: Parsing task

Posted by didge <di...@foundrylogic.com>.
VPP (http://vpp.sourceforge.com) is an option.  You would simply write a
template for your run.xml using VTL and then process it with the <vpp> task
to generate an environment specific version.

didge

> -----Original Message-----
> From: Chris Reeves [mailto:CReeves@medfusion.net]
> Sent: Tuesday, February 11, 2003 1:44 PM
> To: user@ant.apache.org
> Subject: Parsing task
>
>
> I've been searching for a task that would do a little parsing for
> me...it seems I've seen this sort of thing before, but that may have
> been a dream...
>
> I have two ant xml files for my project - one builds the project
> (build.xml), one runs the executable (run.xml) produced by the build;
> this second file is simply bundled with the distribution.
>
> It works great - except that the properties in the run.xml must be
> changed on a per-environment basis (dev, stage, prod). And I only need
> to change a couple of lines.
>
> So, I'd like to have something like:
>
> <!-- ========== mail properties ========== -->
>
> <dev>
> <property name="to.address"
> value="devuser@nowhere.com"/>
> <property name="from.address"
> value="devappthingy@nowhere.com"/>
> <property name="smtp.server"
> value="myserver.nowhere.com"/>
> </dev>
>
> <stage>
> <property name="to.address"
> value="devuser@nowhere.com"/>
> <property name="from.address"
> value="stageappthingy@nowhere.com"/>
> <property name="smtp.server"
> value="myserver.nowhere.com"/>
> </stage>
>
> <prod>
> <property name="to.address"
> value="produser1@nowhere.com, produser1@nowhere.com"/>
> <property name="from.address"
> value="appthingy@nowhere.com"/>
> <property name="smtp.server"
> value="myserver.prod.nowhere.com"/>
> </prod>
>
> The end product should contain only the xml relevant for the environment
> it was built for.
>
> Also, I know I could run ant with a specific target that sets these
> properties, but that means that all properties for all env's would be on
> each system.
>
> I suppose I could use xslt to alter the file, but it seems there should
> be something easier. I scoured the Hatchet/Loughran book, but didn't
> find what I was looking for. Any ideas?
>
> Chris
>
> ----------------------------------------
> Chris Reeves
> Senior Software Developer
> Medfusion, Inc.
> creeves@medfusion.net
> ----------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


RE: Parsing task

Posted by William Ferguson <wi...@versata.com.au>.
Try either
1) using the antcall task with different properties specified.
2) using 3 different property files. The one to be loaded is defined by a
paramter passed to Ant on the cmd line.

Hope this helps.

William


-----Original Message-----
From: Chris Reeves [mailto:CReeves@medfusion.net]
Sent: Wednesday, February 12, 2003 8:44 AM
To: user@ant.apache.org
Subject: Parsing task


I've been searching for a task that would do a little parsing for
me...it seems I've seen this sort of thing before, but that may have
been a dream...

I have two ant xml files for my project - one builds the project
(build.xml), one runs the executable (run.xml) produced by the build;
this second file is simply bundled with the distribution.

It works great - except that the properties in the run.xml must be
changed on a per-environment basis (dev, stage, prod). And I only need
to change a couple of lines.

So, I'd like to have something like:

<!-- ========== mail properties ========== -->

<dev>
<property name="to.address"
value="devuser@nowhere.com"/>
<property name="from.address"
value="devappthingy@nowhere.com"/>
<property name="smtp.server"
value="myserver.nowhere.com"/>
</dev>

<stage>
<property name="to.address"
value="devuser@nowhere.com"/>
<property name="from.address"
value="stageappthingy@nowhere.com"/>
<property name="smtp.server"
value="myserver.nowhere.com"/>
</stage>

<prod>
<property name="to.address"
value="produser1@nowhere.com, produser1@nowhere.com"/>
<property name="from.address"
value="appthingy@nowhere.com"/>
<property name="smtp.server"
value="myserver.prod.nowhere.com"/>
</prod>

The end product should contain only the xml relevant for the environment
it was built for.

Also, I know I could run ant with a specific target that sets these
properties, but that means that all properties for all env's would be on
each system.

I suppose I could use xslt to alter the file, but it seems there should
be something easier. I scoured the Hatchet/Loughran book, but didn't
find what I was looking for. Any ideas?

Chris

----------------------------------------
Chris Reeves
Senior Software Developer
Medfusion, Inc.
creeves@medfusion.net
----------------------------------------

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