ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Satish Jeejula" <Satish_Jeej...@irco.com>
Subject RE: Using command line arguments
Date Thu, 16 Sep 2004 19:38:37 GMT
<HTML>
<BODY>
Jeff,

Thanks for the help. I have tested the solution you provided which works
and will keep Charles approach in mind.

Thanks guys,
Satish

-----Original Message-----
From: Jeff Davidson [mailto:JeffD@rocketgaming.com] 
Sent: Thursday, September 16, 2004 1:33 PM
To: Ant Users List
Subject: RE: Using command line arguments

Satish,

I suspect that Charles' answer is probably more appropriate, but to
answer your question...

Specifying -DdeleteBuildDir=true on the command-line will cause a
property called "deleteBuildDir" to be set to "true", and accessible via
${deleteBuildDir}.

For example,

<echo>${deleteBuildDir}</echo>

Regarding the if="" attribute, you don't care if the value of the
deleteBuildDir property is true, false, foo, or any other value.  All
that matters is whether or not the property is defined.  That is the
behavior of the if="" attribute.

For example,

<target name="clean" if="deleteBuildDir">
    <!-- Only gets executed if deleteBuildDir is defined,
         for example by a command-line argument such as:
         -DdeleteBuildDir=xyz
    -->
    <delete ... />
</target>

But, again, you probably want to look at Charles' reply, as it is
probably more straightforward.

Regards,
~Jeff


-----Original Message-----
From: Satish Jeejula [mailto:Satish_Jeejula@irco.com] 
Sent: September 16, 2004 11:24
To: user@ant.apache.org
Subject: RE: Using command line arguments


Jeff,

How can pass the value from command line to the property in build file?

In my example, "deleteBuildDir=true" should be copied to the property in
the build file. Also the 'if' attribute checks to the property is set or
not. It does not check to see if the value of the property is true or
false.

But if I can figure out a way to take the command-line and set the
property at run time, it should work.

Thanks,
Satish

-----Original Message-----
From: Jeff Davidson [mailto:JeffD@rocketgaming.com]
Sent: Thursday, September 16, 2004 1:13 PM
To: Ant Users List
Subject: RE: Using command line arguments

Satish,

You want to investigate the if="${property}" attribute of the <target/>
element.  That attribute specifies that the target should only run if
the given property is defined.  (i.e. by your command-line argument)

http://ant.apache.org/manual/using.html#targets

Regards,
~Jeff

-----Original Message-----
From: Satish Jeejula [mailto:Satish_Jeejula@irco.com]
Sent: September 16, 2004 11:08
To: user@ant.apache.org
Subject: Using command line arguments

Hi All,
 
I just started learning ANT tool. I have a simple build file that
compiles java file into a build directory successfully. The build file
right now deletes the build directory every time it runs. I would like
to change it such a way so that the build directory is deleted only when
user specifies it as command-line argument.
 
e.g.: ant -f compile.xml compile -DdeleteBuildDir=true  ----> should
delete the build directory
e.g.: ant -f comile.xml compile ----> should not delete the build
directory.
 
I am thinking of creating another target which deletes the directory.
Then execute that target only when this command-line argument is passed.
 
Please let me know if this can achieved and if so, any clue or hints
will help me.
 
Thanks,
Satish



-----------------------------------------
The information contained in this message is privileged and intended
only for the recipients named. If the reader is not a representative of
the intended recipient, any review, dissemination or copying of this
message or the information it contains is prohibited. If you have
received this message in error, please immediately notify the sender,
and delete the original message and attachments. 
  
 
This electronic message transmission, including attachments, is for the
exclusive use of the individuals to which this e-mail is addressed and
is to be reviewed and used exclusively for authorized company purposes.
This transmission may contain proprietary, confidential or privileged
information.  If you are not the intended recipient of this
transmission, you are hereby notified that any use, copying, disclosure,
dissemination, distribution or taking of any action in reliance upon the
contents of this transmission is strictly prohibited.  If you believe
you may have received this electronic message in error, please notify
the sender immediately by return email and delete or destroy the
original message and/or any copy of it from your computer system and/or
your files.  Thank you. 

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

R

-----------------------------------------
The information contained in this message is privileged and intended
only for the recipients named. If the reader is not a representative of
the intended recipient, any review, dissemination or copying of this
message or the information it contains is prohibited. If you have
received this message in error, please immediately notify the sender,
and delete the original message and attachments.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org 
  
 
This electronic message transmission, including attachments, is for the
exclusive use of the individuals to which this e-mail is addressed and
is to be reviewed and used exclusively for authorized company purposes.
This transmission may contain proprietary, confidential or privileged
information.  If you are not the intended recipient of this
transmission, you are hereby notified that any use, copying, disclosure,
dissemination, distribution or taking of any action in reliance upon the
contents of this transmission is strictly prohibited.  If you believe
you may have received this electronic message in error, please notify
the sender immediately by return email and delete or destroy the
original message and/or any copy of it from your computer system and/or
your files.  Thank you. 

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

<P><hr size=1></P>
<P><STRONG>The information contained in this message is privileged and intended
only for the recipients named. If the reader is not a representative of the intended recipient,
any review, dissemination or copying of this message or the information it contains is prohibited.
If you have received this message in error, please immediately notify the sender, and delete
the original message and attachments.</STRONG></P>
</BODY>
</HTML>


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


Mime
View raw message