Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

Re: Migrating form ANT 1.6 to 1.7: xmlproperty

Olivier Gies

2008-02-19

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi Sam,

From my point of view, a solid approach would simply be to override
Ant's <xmlproperty> task with a new attribute like "setempty", set to
"false", or "true" depending on the convenience, by default... Then use
<taskdef> to define your overriding class as the <xmlproperty> task.

Olivier

-------- Original Message --------
Subject: Migrating form ANT 1.6 to 1.7: xmlproperty
From: Samuel Monsarrat <samuel.monsarrat@(protected)>
To: user@(protected)
Date: 19/02/2008 21:49

> I am attempting to migrate a large ANT build system from 1.6 to 1.7 and
> am running into a problem with xmlproperty.
> We use xmlproperty massively in our build system and very often "stack"
> several xmlproperty calls in order to build a complex property 'tree',
> where several inter-dependent build files will declare and/or overload
> parts of the tree using xmlproperty.
> Our approach however is completely incompatible with ANT 1.7 due to a
> modification to xmlproperty (bug 26286 c.f.
> http://issues.apache.org/bugzilla/show_bug.cgi?id=26286) that forces
> "empty" elements in an XML property tree to be declared.
>
> Consider the following exemple:
> ===> build_A.xml :
> <project name="Bui_A" default="All">
>   <xmlproperty file="about_A.xml"/>
>   <import file="build_B.xml"/>
>   <target name="All">
>     <ant target="Bui_B.main"/>
>   </target>
> </project>
>
> ===> about_A.xml:
> <app>
>   <version developmentStage="beta"/>
> </app>
>
> ===> build_B.xml :
> <project name="Bui_B">
>   <xmlproperty file="about_B.xml"/>
>   <target name="Bui_B.main">
>     <echo message="The version number is: '${app.version}'"/>
>     <echo message="The development stage is:
> ${app.version(developmentStage)}"/>
>     <!-- etc.... -->
>   </target>
> </project>
>
> ===> about_B.xml:
> <app>
>   <version developmentStage="final">2.4.0</version>
> </app>
>
> The aim is : When running build_A.xml use most of about_B.xml but
> overload certain parts of it with about_A.xml
>
> In ANT 1.6 about_A.xml would only set property
> app.version(developmentStage) effectively overloading the
> developmentStage defined in about_B.xml, but with ANT 1.7, about_A.xml
> also sets the property app.version to "empty" thus making it impossible
> for about_B.xml to define it as 2.4.0.
>
> In ANT 1.6 the output is:
> [echo] The version number is: '2.4.0'
> [echo] The development stage is: 'beta'
>
> in ANT 1.7 the output is:
> [echo] The version number is: ''
> [echo] The development stage is: 'beta'
>
> This makes it impossible to use xmlproperty to overload a single path in
> a complex property tree, and therefore destroys one of the main features
> of the task as far as I can see.
> Has anybody come across the same problem? any workaround?
> Regards,
> Samuel.
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)

--
*Olivier Gies*

*Delivery Manager
Customs & Tax Software Engineering Center
Bull, Architect of an Open World ^TM
Phone: +86 (10) 65978001 - Ext 555 *

*www.bull.com <http://www.bull.com/>*

*This e-mail contains material that is confidential for the sole use of
the intended recipient. Any review, reliance or distribution by others
or forwarding without express permission is strictly prohibited. If you
are not the intended recipient, please contact the sender and delete all
copies.*


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.