You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Saberex <Sa...@gmx.net> on 2009/06/15 16:52:02 UTC
replace version info in maven2 pom with ant
Hi to all,
I´ m trying to filter/replace a maven2 pom with ant.
So long not the biggest problem. One is my need to replace the <version>
</version> property.
So far just a small problem. I only have to replace the version which is
inside 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
--
View this message in context: http://www.nabble.com/replace-version-info-in-maven2-pom-with-ant-tp24035984p24035984.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: replace version info in maven2 pom with ant
Posted by "Scot P. Floess" <sf...@nc.rr.com>.
OK - I must confess something here... I do a ton of XSLT work...and never
knew you could just prefix with colon... That is nice to know!
On Thu, 19 Nov 2009, Brian Agnew wrote:
> The colon means you're specifying a *local* name for the element - i.e.
> independent of the namespacing in the document (which confuses matters
> otherwise).
>
> Brian
>
>>
>> Hello,
>>
>> thanks you for your answer.
>>
>> I have a question : why do you use the « : » character to browse the XML
>> document (cf. path="//:project/:parent/:version/text()") in using the
>> XmlTask task ?
>>
>> It seems that XPath language don't use this symbol.
>>
>> Thanks a lot,
>> Fabien.
>>
>>
>>
>>
>>
>>
>> Jhoomsharabi-2 wrote:
>>>
>>>
>>>
>>> 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 <Sa...@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
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/replace-version-info-in-maven2-pom-with-ant-tp24035984p26421350.html
>> Sent from the Ant - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>
>
> --
> Brian Agnew http://www.oopsconsultancy.com
> OOPS Consultancy Ltd
> Tel: +44 (0)7720 397526
> Fax: +44 (0)20 8682 0012
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549
252-478-8087 (Home)
919-890-8117 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim
Architect Keros http://sourceforge.net/projects/keros
Re: replace version info in maven2 pom with ant
Posted by Brian Agnew <br...@oopsconsultancy.com>.
The colon means you're specifying a *local* name for the element - i.e.
independent of the namespacing in the document (which confuses matters
otherwise).
Brian
>
> Hello,
>
> thanks you for your answer.
>
> I have a question : why do you use the « : » character to browse the XML
> document (cf. path="//:project/:parent/:version/text()") in using the
> XmlTask task ?
>
> It seems that XPath language don't use this symbol.
>
> Thanks a lot,
> Fabien.
>
>
>
>
>
>
> Jhoomsharabi-2 wrote:
>>
>>
>>
>> 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 <Sa...@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
>>
>>
>>
>
> --
> View this message in context:
> http://old.nabble.com/replace-version-info-in-maven2-pom-with-ant-tp24035984p26421350.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
--
Brian Agnew http://www.oopsconsultancy.com
OOPS Consultancy Ltd
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: replace version info in maven2 pom with ant
Posted by Fabien314000 <fa...@gmail.com>.
Hello,
thanks you for your answer.
I have a question : why do you use the « : » character to browse the XML
document (cf. path="//:project/:parent/:version/text()") in using the
XmlTask task ?
It seems that XPath language don't use this symbol.
Thanks a lot,
Fabien.
Jhoomsharabi-2 wrote:
>
>
>
> 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 <Sa...@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
>
>
>
--
View this message in context: http://old.nabble.com/replace-version-info-in-maven2-pom-with-ant-tp24035984p26421350.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: replace version info in maven2 pom with ant
Posted by jh...@netscape.net.
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 <Sa...@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
Re: replace version info in maven2 pom with ant
Posted by Michael Alsen <mi...@gmx.net>.
http://n2.nabble.com/transform-xml-to-xml-using-xslt-and-ant-tp3092022p3092022.html
--
View this message in context: http://www.nabble.com/replace-version-info-in-maven2-pom-with-ant-tp24035984p24071514.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org