You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Iv�n Perdomo <ia...@yahoo.com> on 2008/04/25 17:50:55 UTC
Set a property based on a regular expression (without ant-contrib)
Hi all,
I'm new to ant and I'm facing the following problem:
I want to know the current ant version, e.g. 1.7.0, I
know that there are built-in properties, but in some
linux distros -like gentoo- the {$ant.version}
property result is:
Apache Ant version 1.7.0 compiled on April 8 2008
and I just want only the "1.7.0" part. Is There a way
to set a value of a property based on the match of a
regular expression, similar to propertyregexp of
ant-contrib? I want to do it with ant's core, not
external libraries.
I hope that someone can give some advice.
Best Regards,
--
Iván Perdomo
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
AW: AW: Set a property based on a regular expression (without ant-contrib)
Posted by Ja...@rzf.fin-nrw.de.
Then use Stefans <available>s in a <condition>
<condition property="version" value="1.7.0"><available-17>
<condition property="version" value="1.6.3"><available-163>
...
Since Ant 1.7.1 you could use <antversion>
<project>
<antversion property="v"/>
<echo>Version: ${v}</echo>
</project>
So maybe you want to use that task and port that to your environment.
Jan
> -----Ursprüngliche Nachricht-----
> Von: Iván" Perdomo [mailto:ia_perdomo@yahoo.com]
> Gesendet: Montag, 28. April 2008 13:30
> An: Ant Users List
> Betreff: Re: AW: Set a property based on a regular expression
> (without ant-contrib)
>
> Hi Jan,
>
> Thanks for your reply, but is not what I want. I want
> to extract the number part of the $ant.version
> property. e.g.
>
> Apache Ant version 1.7.0 compiled on April 8 2008
>
> I just want the "1.7.0" part ant store it in another
> property. Is possible with ant-contrib [1] but I don't
> want to use third-party libraries.
>
> Thanks,
>
> [1]
> http://ant-contrib.sourceforge.net/tasks/tasks/propertyregex.html
>
> --
> Iván Perdomo
>
>
> --- Jan.Materne@rzf.fin-nrw.de wrote:
>
> > Stefan blogged about that ...
> >
> http://stefan.samaflost.de/blog/en/Apache/Ant/how_to_detect_170.html
> >
> http://stefan.samaflost.de/blog/en/Apache/Ant/how_to_detect_163.html
> >
> http://stefan.samaflost.de/blog/2004/10/07#how_to_detect_162
> >
> >
> > Jan
> >
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: David Weintraub [mailto:qazwart@gmail.com]
> > > Gesendet: Freitag, 25. April 2008 22:39
> > > An: Ant Users List
> > > Betreff: Re: Set a property based on a regular
> > expression
> > > (without ant-contrib)
> > >
> > > This might exactly what you're looking for: Check
> > the <condition>
> > > task. It has the ability to examine the Ant
> > version, so you can verify
> > > that you're running the correct Ant version.
> > >
> > > If not, take a look at the AntContrib task
> > <propertyregex>.
> > >
> >
> <http://ant-contrib.sourceforge.net/tasks/tasks/index.html>
> > >
> > > That will let you filter out the version ID from
> > the property string.
> > >
> > > On Fri, Apr 25, 2008 at 11:50 AM, Iván Perdomo
> > > <ia...@yahoo.com> wrote:
> > > > Hi all,
> > > >
> > > > I'm new to ant and I'm facing the following
> > problem:
> > > >
> > > > I want to know the current ant version, e.g.
> > 1.7.0, I
> > > > know that there are built-in properties, but in
> > some
> > > > linux distros -like gentoo- the {$ant.version}
> > > > property result is:
> > > >
> > > > Apache Ant version 1.7.0 compiled on April 8
> > 2008
> > > >
> > > > and I just want only the "1.7.0" part. Is There
> > a way
> > > > to set a value of a property based on the match
> > of a
> > > > regular expression, similar to propertyregexp
> > of
> > > > ant-contrib? I want to do it with ant's core,
> > not
> > > > external libraries.
> > > >
> > > > I hope that someone can give some advice.
> > > >
> > > > Best Regards,
> > > >
> > > > --
> > > > Iván Perdomo
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
> ______________________________________________________________
> > > ______________________
> > > > Be a better friend, newshound, and
> > > > know-it-all with Yahoo! Mobile. Try it now.
> > >
> >
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > user-unsubscribe@ant.apache.org
> > > > For additional commands, e-mail:
> > user-help@ant.apache.org
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > --
> > > David Weintraub
> > > qazwart@gmail.com
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail:
> > user-help@ant.apache.org
> > >
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> > user-help@ant.apache.org
> >
> >
>
>
>
>
> ______________________________________________________________
> ______________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now.
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: AW: Set a property based on a regular expression (without ant-contrib)
Posted by Iv�n Perdomo <ia...@yahoo.com>.
Hi Jan,
Thanks for your reply, but is not what I want. I want
to extract the number part of the $ant.version
property. e.g.
Apache Ant version 1.7.0 compiled on April 8 2008
I just want the "1.7.0" part ant store it in another
property. Is possible with ant-contrib [1] but I don't
want to use third-party libraries.
Thanks,
[1]
http://ant-contrib.sourceforge.net/tasks/tasks/propertyregex.html
--
Iván Perdomo
--- Jan.Materne@rzf.fin-nrw.de wrote:
> Stefan blogged about that ...
>
http://stefan.samaflost.de/blog/en/Apache/Ant/how_to_detect_170.html
>
http://stefan.samaflost.de/blog/en/Apache/Ant/how_to_detect_163.html
>
http://stefan.samaflost.de/blog/2004/10/07#how_to_detect_162
>
>
> Jan
>
>
> > -----Ursprüngliche Nachricht-----
> > Von: David Weintraub [mailto:qazwart@gmail.com]
> > Gesendet: Freitag, 25. April 2008 22:39
> > An: Ant Users List
> > Betreff: Re: Set a property based on a regular
> expression
> > (without ant-contrib)
> >
> > This might exactly what you're looking for: Check
> the <condition>
> > task. It has the ability to examine the Ant
> version, so you can verify
> > that you're running the correct Ant version.
> >
> > If not, take a look at the AntContrib task
> <propertyregex>.
> >
>
<http://ant-contrib.sourceforge.net/tasks/tasks/index.html>
> >
> > That will let you filter out the version ID from
> the property string.
> >
> > On Fri, Apr 25, 2008 at 11:50 AM, Iván Perdomo
> > <ia...@yahoo.com> wrote:
> > > Hi all,
> > >
> > > I'm new to ant and I'm facing the following
> problem:
> > >
> > > I want to know the current ant version, e.g.
> 1.7.0, I
> > > know that there are built-in properties, but in
> some
> > > linux distros -like gentoo- the {$ant.version}
> > > property result is:
> > >
> > > Apache Ant version 1.7.0 compiled on April 8
> 2008
> > >
> > > and I just want only the "1.7.0" part. Is There
> a way
> > > to set a value of a property based on the match
> of a
> > > regular expression, similar to propertyregexp
> of
> > > ant-contrib? I want to do it with ant's core,
> not
> > > external libraries.
> > >
> > > I hope that someone can give some advice.
> > >
> > > Best Regards,
> > >
> > > --
> > > Iván Perdomo
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
>
______________________________________________________________
> > ______________________
> > > Be a better friend, newshound, and
> > > know-it-all with Yahoo! Mobile. Try it now.
> >
>
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail:
> user-help@ant.apache.org
> > >
> > >
> >
> >
> >
> > --
> > --
> > David Weintraub
> > qazwart@gmail.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> user-help@ant.apache.org
> >
> >
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
>
>
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
AW: Set a property based on a regular expression (without ant-contrib)
Posted by Ja...@rzf.fin-nrw.de.
Stefan blogged about that ...
http://stefan.samaflost.de/blog/en/Apache/Ant/how_to_detect_170.html
http://stefan.samaflost.de/blog/en/Apache/Ant/how_to_detect_163.html
http://stefan.samaflost.de/blog/2004/10/07#how_to_detect_162
Jan
> -----Ursprüngliche Nachricht-----
> Von: David Weintraub [mailto:qazwart@gmail.com]
> Gesendet: Freitag, 25. April 2008 22:39
> An: Ant Users List
> Betreff: Re: Set a property based on a regular expression
> (without ant-contrib)
>
> This might exactly what you're looking for: Check the <condition>
> task. It has the ability to examine the Ant version, so you can verify
> that you're running the correct Ant version.
>
> If not, take a look at the AntContrib task <propertyregex>.
> <http://ant-contrib.sourceforge.net/tasks/tasks/index.html>
>
> That will let you filter out the version ID from the property string.
>
> On Fri, Apr 25, 2008 at 11:50 AM, Iván Perdomo
> <ia...@yahoo.com> wrote:
> > Hi all,
> >
> > I'm new to ant and I'm facing the following problem:
> >
> > I want to know the current ant version, e.g. 1.7.0, I
> > know that there are built-in properties, but in some
> > linux distros -like gentoo- the {$ant.version}
> > property result is:
> >
> > Apache Ant version 1.7.0 compiled on April 8 2008
> >
> > and I just want only the "1.7.0" part. Is There a way
> > to set a value of a property based on the match of a
> > regular expression, similar to propertyregexp of
> > ant-contrib? I want to do it with ant's core, not
> > external libraries.
> >
> > I hope that someone can give some advice.
> >
> > Best Regards,
> >
> > --
> > Iván Perdomo
> >
> >
> >
> >
> >
> >
> >
> ______________________________________________________________
> ______________________
> > Be a better friend, newshound, and
> > know-it-all with Yahoo! Mobile. Try it now.
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>
>
>
> --
> --
> David Weintraub
> qazwart@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Set a property based on a regular expression (without ant-contrib)
Posted by David Weintraub <qa...@gmail.com>.
This might exactly what you're looking for: Check the <condition>
task. It has the ability to examine the Ant version, so you can verify
that you're running the correct Ant version.
If not, take a look at the AntContrib task <propertyregex>.
<http://ant-contrib.sourceforge.net/tasks/tasks/index.html>
That will let you filter out the version ID from the property string.
On Fri, Apr 25, 2008 at 11:50 AM, Iván Perdomo <ia...@yahoo.com> wrote:
> Hi all,
>
> I'm new to ant and I'm facing the following problem:
>
> I want to know the current ant version, e.g. 1.7.0, I
> know that there are built-in properties, but in some
> linux distros -like gentoo- the {$ant.version}
> property result is:
>
> Apache Ant version 1.7.0 compiled on April 8 2008
>
> and I just want only the "1.7.0" part. Is There a way
> to set a value of a property based on the match of a
> regular expression, similar to propertyregexp of
> ant-contrib? I want to do it with ant's core, not
> external libraries.
>
> I hope that someone can give some advice.
>
> Best Regards,
>
> --
> Iván Perdomo
>
>
>
>
>
>
> ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
--
--
David Weintraub
qazwart@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org