You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Ja...@rzf.fin-nrw.de on 2007/02/12 13:01:37 UTC

AW: Value of the property is not visible in the imported build file.

>In my custom ant task,  I set the value of a getter method to a
>property, and I can refer this property value using ${somevariable} in
>the build.xml,  but when I try to access this property value in the
same
>way in another build file which is imported in the previous build file,
>it does not retain its its value.


I am not sure if I understand your problem ...



You have a Task with a property, eg

  MyTask {
    String foo;
    setFoo(String f) { 
      foo = f;
    }
    execute() {
      log("Foo is '" + foo + "'");
    }
  }

and in your build.xml you have

  <project>
    <taskdef name="mytask" classname="MyTask" classpath="mytask.jar"/>
    <property name="foo" value="bar"/>
    <mytask foo="${foo}"/>
  </project>
and you'll get
  [mytask] Foo is 'bar'


And in your second scenario you have

imported.xml
  <project>
    <taskdef name="mytask" classname="MyTask" classpath="mytask.jar"/>  
    <mytask foo="${foo}"/>
  </project>
build.xml
  <project>
    <property name="foo" value="bar"/>
    <import file="imported.xml"/>
  </project>


that wont work?



Jan


> 
>it gives ${somevariable}....
> 
>Can somebody give some pointers on this please?
> 
>Regards,
> 
> 
> 
> 
>
>
>DISCLAIMER:
>Unless indicated otherwise, the information contained in this 
>message is privileged and confidential, and is intended only 
>for the use of the addressee(s) named above and others who 
>have been specifically authorized to receive it. If you are 
>not the intended recipient, you are hereby notified that any 
>dissemination, distribution or copying of this message and/or 
>attachments is strictly prohibited. The company accepts no 
>liability for any damage caused by any virus transmitted by 
>this email. Furthermore, the company does not warrant a proper 
>and complete transmission of this information, nor does it 
>accept liability for any delays. If you have received this 
>message in error, please contact the sender and delete the 
>message. Thank you.
>

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