ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jhoomshar...@netscape.net
Subject Re: replace version info in maven2 pom with ant
Date Tue, 16 Jun 2009 06:57:52 GMT


Why don't you use xmltask by oopsconsultancy 
http://www.oopsconsultancy.com/software/xmltask/

If you use xmltask your ant build.xml will look like this:

Say your pom.xml looks like this:

pom.xml
-------
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <parent>
        <version>0.0.0-SNAPSHOT</version>
    </parent>
</project>


So your build.xml will look like this

build.xml
---------
<project name="version-pick" default="read-replace">

 <taskdef name="xmltask" 
             classname="com.oopsconsultancy.xmltask.ant.XmlTask"/>
    
    <target name="read-replace">
        <xmltask source="${pom.path}/pom.xml" dest="${pom.path}/pom.xml" failWithoutMatch="true">
      <replace path="//:project/:parent/:version/text()"
            withText="1.2.00-SNAPSHOT"/>
        </xmltask>
    </target>
</project>



I will say if you use xmltask its easy and you can do lot more operations than you can expect.






parent




-----Original Message-----
From: Saberex <Saberex@gmx.net>
To: user@ant.apache.org
Sent: Mon, Jun 15, 2009 8:22 pm
Subject: replace version info in maven2 pom with ant




i to all,
I´ m trying to filter/replace a maven2 pom with=2
0ant.
o long not the biggest problem. One is my need to replace the <version>
/version> property.
o far just a small problem. I only have to replace the version which is
nside the <parent> </parent> declaration.  
<loadfile srcFile="pom.xml" property="test.pom">    
filterchain>
   <tokenfilter>
        <replaceregex pattern="*-SNAPSHOT" replace="versionIwant" flags="gi"/>
   </tokenfilter>
/filterchain>
Seems not to fit 100%. I would replace all found regex. 
Looking ahead for your replys
Saberex
- 
iew this message in context: http://www.nabble.com/replace-version-info-in-maven2-pom-with-ant-tp24035984p24035984.html
ent from the Ant - Users mailing list archive at Nabble.com.

--------------------------------------------------------------------
o unsubscribe, e-mail: user-unsubscribe@ant.apache.org
or additional commands, e-mail: user-help@ant.apache.org


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message