Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > ant - howto echo <path id=...>

Reply
Thread Tools

ant - howto echo <path id=...>

 
 
coltrane
Guest
Posts: n/a
 
      06-14-2006
I am sure this question has been asked and answered but.....

Is it possible to echo an refid?

ie.
<path id="classpath">
<pathelement location="${common_lib.dir}/xpp3.jar"/>
<pathelement location="${common_lib.dir}/jibx-run.jar"/>
<pathelement location="${common_lib.dir}/jibx-bind.jar"/>
<pathelement location="${common_lib.dir}/oracle/ojdbc.jar"/>
<pathelement location="${common_lib.dir}/oracle/classes12.jar"/>
<pathelement location="${tomcat.dir}/common/lib/servlet-api.jar"/>
</path>
<echo message="refid classpath"/>

Thanks for the help

john

 
Reply With Quote
 
 
 
 
Gilbert Rebhan
Guest
Posts: n/a
 
      06-14-2006
Hi,


coltrane wrote:
> I am sure this question has been asked and answered but.....
>
> Is it possible to echo an refid?
> <path id="classpath">
> <pathelement location="${common_lib.dir}/xpp3.jar"/>
> <pathelement location="${common_lib.dir}/jibx-run.jar"/>
> <pathelement location="${common_lib.dir}/jibx-bind.jar"/>
> <pathelement location="${common_lib.dir}/oracle/ojdbc.jar"/>
> <pathelement location="${common_lib.dir}/oracle/classes12.jar"/>
> <pathelement location="${tomcat.dir}/common/lib/servlet-api.jar"/>
> </path>
> <echo message="refid classpath"/>


yup, there's a 'hack' with refid's / id's (undocumented)
the ant developers say one shouldn't use it, as it could be
altered in the next ant version.
that said, i use it a lot

just put the line
<echo message="${toString:classpath}"/>
instead of <echo message="refid classpath"/>
and you have it all on one line separated with ';'

with antcontrib or antelope <for> task you may do things like =

<for list="${toString:classpath}" param="pathitem" delimiter=";">
<sequential>
<echo>pathitem == @{pathitem}${line.separator}</echo>
</sequential>
</for>

[1] http://ant-contrib.sourceforge.net/
[2] http://antelope.tigris.org/

bye4now, Gilbert

P.S.:

if you're using ant regularly subscribe the ant user list - recommended

the antelope tasks should have been merged into antcontrib
but that ain't finished, so i use both.

there might also be another (somewhat 'cleaner') way via <pathconvert>
task that ships with ant, just have a look into the ant manual.

 
Reply With Quote
 
 
 
 
coltrane
Guest
Posts: n/a
 
      06-14-2006

Gilbert Rebhan wrote:
> Hi,
>
>
> coltrane wrote:
> > I am sure this question has been asked and answered but.....
> >
> > Is it possible to echo an refid?
> > <path id="classpath">
> > <pathelement location="${common_lib.dir}/xpp3.jar"/>
> > <pathelement location="${common_lib.dir}/jibx-run.jar"/>
> > <pathelement location="${common_lib.dir}/jibx-bind.jar"/>
> > <pathelement location="${common_lib.dir}/oracle/ojdbc.jar"/>
> > <pathelement location="${common_lib.dir}/oracle/classes12.jar"/>
> > <pathelement location="${tomcat.dir}/common/lib/servlet-api.jar"/>
> > </path>
> > <echo message="refid classpath"/>

>
> yup, there's a 'hack' with refid's / id's (undocumented)
> the ant developers say one shouldn't use it, as it could be
> altered in the next ant version.
> that said, i use it a lot
>
> just put the line
> <echo message="${toString:classpath}"/>
> instead of <echo message="refid classpath"/>
> and you have it all on one line separated with ';'
>
> with antcontrib or antelope <for> task you may do things like =
>
> <for list="${toString:classpath}" param="pathitem" delimiter=";">
> <sequential>
> <echo>pathitem == @{pathitem}${line.separator}</echo>
> </sequential>
> </for>
>
> [1] http://ant-contrib.sourceforge.net/
> [2] http://antelope.tigris.org/
>
> bye4now, Gilbert
>
> P.S.:
>
> if you're using ant regularly subscribe the ant user list - recommended
>
> the antelope tasks should have been merged into antcontrib
> but that ain't finished, so i use both.
>
> there might also be another (somewhat 'cleaner') way via <pathconvert>
> task that ships with ant, just have a look into the ant manual.


 
Reply With Quote
 
jeeeff jeeeff is offline
Junior Member
Join Date: Jun 2009
Posts: 1
 
      06-03-2009
Or you can simply assign the refid to a property then echo the property

<property name="myproperty" refid="someref"/>
<echo message="${myproperty}/>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error runing ant in eclipse ant view yihucd@gmail.com Java 1 03-07-2006 08:39 PM
ant inherifRefs & echo for variables ion Java 2 04-28-2005 06:50 PM
trouble with Hibernate and Ant (probably just Ant) john martin Java 2 04-07-2005 09:27 PM
wondering how i can launch tomcat from ant without ant hanging... Chris Bedford Java 6 12-23-2004 12:41 AM
echo echo echo craig judd Computer Support 1 09-23-2003 08:53 PM



Advertisments