You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Gian Franco Casula <gi...@topficie.nl> on 2004/07/05 11:06:24 UTC

Batch script with arguments

Hi,

I am writing a batch script that sets some environment
variables and then runs ant.

I would like to allow the user to specify an argument to
the script (e.g. a directory name). The value of the argument
should then be used by Ant as a property.

More precisely, the argument is the location of my source
classes that Ant should compile.

Is this possible?

Thanks in advance,

Gian Franco Casula

Re: Batch script with arguments

Posted by Gian Franco Casula <gi...@topficie.nl>.
Thanks Ivan and Antoine!


>Why do you needed to dynamically load it?

The batch file will be located on a server
from where different users can acces it. Each
user might have his/her sources locally on
different paths. By asking for the path I'm
trying to overcome these differences.

Thanks again,

Gian Franco

----- Original Message -----
From: "Ivan Ivanov" <ra...@yahoo.com>
To: "Ant Users List" <us...@ant.apache.org>; "Gian Franco Casula"
<gi...@topficie.nl>
Sent: Monday, July 05, 2004 11:20 AM
Subject: Re: Batch script with arguments


> Hello, Gian
> yes it is possible. However, I do not remember now how
> the user is prompt for input via a bat file. Instead,
> I can recommend you to use ant task <input> [1]:
>
> <input message="Please enter the sources dir"
>     addproperty="project.src.dir"
>     defaultvalue="${basedir}/src"/>
> <echo message="Source dir is ${project.src.dir}"/>
>
> This will prompt you for an input in your console.
> What you enter will be kept in the property named
> project.src.dir and if you enter nothing, the value of
> this property will be the defaultvalue ${basedir}/src.
>
> HTH Ivan
>
> P.S. I have some resistance against <input> task (BUT
> it works perferctly), since it requires human
> intervention, which immediately spoils the automation.
> Something more, a project sources' directory changes
> almost never. Why do you needed to dynamically load
> it?
>
> [1]http://ant.apache.org/manual/CoreTasks/input.html
>
> --- Gian Franco Casula
> <gi...@topficie.nl> wrote:
> > Hi,
> >
> > I am writing a batch script that sets some
> > environment
> > variables and then runs ant.
> >
> > I would like to allow the user to specify an
> > argument to
> > the script (e.g. a directory name). The value of the
> > argument
> > should then be used by Ant as a property.
> >
> > More precisely, the argument is the location of my
> > source
> > classes that Ant should compile.
> >
> > Is this possible?
> >
> > Thanks in advance,
> >
> > Gian Franco Casula
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.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: Batch script with arguments

Posted by Ivan Ivanov <ra...@yahoo.com>.
Hello, Gian
yes it is possible. However, I do not remember now how
the user is prompt for input via a bat file. Instead,
I can recommend you to use ant task <input> [1]:

<input message="Please enter the sources dir"
    addproperty="project.src.dir"
    defaultvalue="${basedir}/src"/>
<echo message="Source dir is ${project.src.dir}"/>

This will prompt you for an input in your console.
What you enter will be kept in the property named
project.src.dir and if you enter nothing, the value of
this property will be the defaultvalue ${basedir}/src.

HTH Ivan

P.S. I have some resistance against <input> task (BUT
it works perferctly), since it requires human
intervention, which immediately spoils the automation.
Something more, a project sources' directory changes
almost never. Why do you needed to dynamically load
it? 

[1]http://ant.apache.org/manual/CoreTasks/input.html

--- Gian Franco Casula
<gi...@topficie.nl> wrote:
> Hi,
> 
> I am writing a batch script that sets some
> environment
> variables and then runs ant.
> 
> I would like to allow the user to specify an
> argument to
> the script (e.g. a directory name). The value of the
> argument
> should then be used by Ant as a property.
> 
> More precisely, the argument is the location of my
> source
> classes that Ant should compile.
> 
> Is this possible?
> 
> Thanks in advance,
> 
> Gian Franco Casula
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org