You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Russell G. Wells" <rw...@bearriver.com> on 2001/08/29 23:16:20 UTC

how to reference a command line argument inside ant script

I want to create a target in my build.xml file for getting a tagged revision
of code out of CVS, with the user specifying the revision name on the
command line.
i.e.
	ant cvsrev build-24

My question is how do I access the argument "build-24" within the build.xml
file.


<!-- check for required environment variable prior to doing anything -->
<target name="init.cvs" unless="osEnv.CVSROOT">
	<fail message="To use ANT CVS you must have CVSROOT defined"/>
</target>

<target name="cvsrev" depends="init.cvs">
	<!-- cvs -q checkout -P -r revision-name module -->
	<cvs command="-q checkout -P -r revision-name ${ant.project.name}"/>
</target>

What should be "revision-name" be replaced with?

----------------
Russell G. Wells
Bear River Associates, Inc.
email:  rwells@bearriver.com


RE: how to reference a command line argument inside ant script

Posted by "Russell G. Wells" <rw...@bearriver.com>.
I was actually hoping for something more user friendly.  I'm trying to get
our QA dept to get the source for a project from cvs and then build it.  The
build part is easy with ant, but the cvs stuff I always seem to have to
resort to yet another script that I have to maintain on 3 platforms.

Oh, well...


-----Original Message-----
From: Jonathan Carlson [mailto:joncrlsn@yahoo.com]
Sent: Wednesday, August 29, 2001 14:35
To: ant-user@jakarta.apache.org
Subject: Re: how to reference a command line argument inside ant script


Doh.  I think I need to get to bed earlier.  Here is what it really
should be

ant cvsrev -Drevision-name="build-24".

Also, revision-name in the target should be replaced with ${revision-name}

Jonathan Carlson wrote:

> You'd use
>
> ant mytarg -Dcvsrev="build-24".
> Then revision-name would be replaced with ${revision-name}
>
> Jonathan Carlson
> joncrlsn@users.sf.net
>
> Russell G. Wells wrote:
>
>> I want to create a target in my build.xml file for getting a tagged
>> revision
>> of code out of CVS, with the user specifying the revision name on the
>> command line.
>> i.e.
>>     ant cvsrev build-24
>>
>> My question is how do I access the argument "build-24" within the
>> build.xml
>> file.
>>
>>
>> <!-- check for required environment variable prior to doing anything -->
>> <target name="init.cvs" unless="osEnv.CVSROOT">
>>     <fail message="To use ANT CVS you must have CVSROOT defined"/>
>> </target>
>>
>> <target name="cvsrev" depends="init.cvs">
>>     <!-- cvs -q checkout -P -r revision-name module -->
>>     <cvs command="-q checkout -P -r revision-name ${ant.project.name}"/>
>> </target>
>>
>> What should be "revision-name" be replaced with?
>>
>> ----------------
>> Russell G. Wells
>> Bear River Associates, Inc.
>> email:  rwells@bearriver.com
>>
>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: how to reference a command line argument inside ant script

Posted by Jonathan Carlson <jo...@yahoo.com>.
Doh.  I think I need to get to bed earlier.  Here is what it really 
should be

ant cvsrev -Drevision-name="build-24". 

Also, revision-name in the target should be replaced with ${revision-name}

Jonathan Carlson wrote:

> You'd use
>
> ant mytarg -Dcvsrev="build-24". 
> Then revision-name would be replaced with ${revision-name}
>
> Jonathan Carlson
> joncrlsn@users.sf.net
>
> Russell G. Wells wrote:
>
>> I want to create a target in my build.xml file for getting a tagged 
>> revision
>> of code out of CVS, with the user specifying the revision name on the
>> command line.
>> i.e.
>>     ant cvsrev build-24
>>
>> My question is how do I access the argument "build-24" within the 
>> build.xml
>> file.
>>
>>
>> <!-- check for required environment variable prior to doing anything -->
>> <target name="init.cvs" unless="osEnv.CVSROOT">
>>     <fail message="To use ANT CVS you must have CVSROOT defined"/>
>> </target>
>>
>> <target name="cvsrev" depends="init.cvs">
>>     <!-- cvs -q checkout -P -r revision-name module -->
>>     <cvs command="-q checkout -P -r revision-name ${ant.project.name}"/>
>> </target>
>>
>> What should be "revision-name" be replaced with?
>>
>> ----------------
>> Russell G. Wells
>> Bear River Associates, Inc.
>> email:  rwells@bearriver.com
>>
>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: how to reference a command line argument inside ant script

Posted by Jonathan Carlson <jo...@yahoo.com>.
You'd use

ant mytarg -Dcvsrev="build-24".  

Then revision-name would be replaced with ${revision-name}

Jonathan Carlson
joncrlsn@users.sf.net

Russell G. Wells wrote:

>I want to create a target in my build.xml file for getting a tagged revision
>of code out of CVS, with the user specifying the revision name on the
>command line.
>i.e.
>	ant cvsrev build-24
>
>My question is how do I access the argument "build-24" within the build.xml
>file.
>
>
><!-- check for required environment variable prior to doing anything -->
><target name="init.cvs" unless="osEnv.CVSROOT">
>	<fail message="To use ANT CVS you must have CVSROOT defined"/>
></target>
>
><target name="cvsrev" depends="init.cvs">
>	<!-- cvs -q checkout -P -r revision-name module -->
>	<cvs command="-q checkout -P -r revision-name ${ant.project.name}"/>
></target>
>
>What should be "revision-name" be replaced with?
>
>----------------
>Russell G. Wells
>Bear River Associates, Inc.
>email:  rwells@bearriver.com
>



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com