ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Burgess, Benjamin" <>
Subject RE: return Substring from java file
Date Mon, 17 Apr 2006 13:29:25 GMT
Firstly, this seems best suited in a macrodef that can set a property
rather than in a custom task.

Secondly, doesn't this already do what you want? :

<basename file="${basedir}" property="warName"/>


-----Original Message-----
From: Uma Maheswar [] 
Sent: Monday, April 17, 2006 9:14 AM
Subject: return Substring from java file


I wanted to do "substring" and get the resultant string in the build.xml
file. This is my java code


public class AntHelper extends Task {

    private String message;

    public void execute() throws BuildException {
        message =
        System.out.println("In Java::"+message);

    public void setMessage(String message) {
        this.message = message;

    public String getMessage(){
        return message;

    public void addText(String message) {
        this.message = message;

    public String createMessage() {
        return message;

And this is my build.xml file

    <target name="build" depends="compile" description="compile and
the war file" >

    	<taskdef name="mytask" classname="AntHelper"
    	<mytask message1="${basedir}"/>

The reason I am doing this is in my project I am having different
and each module will have a common build.xml file. I wanted to generate
the "base directory" name as the "WAR file name".

I get the value printed in the console, but I need the value in the
build.xml file so that I can set the war file name dynamically

       <jar jarfile="${refLocation}/xx.war" basedir="${build.dir}"/>

Any clues please?


Disclaimer: The information contained in this communication is intended
solely for the individual or entity to which it is addressed. It may
contain confidential and/or legally privileged information. Any review,
retransmission, dissemination or other use of, or taking any action in
reliance on the contents of this information by persons or entities
other than the intended recipient is strictly prohibited and may be
unlawful. If you have received this communication in error, please
notify us immediately by responding to this email and then delete it
from your system. Aditya Birla Group Companies attempts to sweep e-mails
and attachments for viruses, it does not guarantee that either are virus
free and that we accept no liability for any damage sustained as a
result of viruses.

To unsubscribe, e-mail:
For additional commands, e-mail:

This message, including any attachments, contains confidential information intended for a
specific individual and purpose, and is protected by law.  If you are not the intended recipient,
please contact sender immediately by reply e-mail and destroy all copies.  You are hereby
notified that any disclosure, copying, or distribution of this message, or the taking of any
action based on it, is strictly prohibited.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message