Discussion:
Custom Task that exports a property
Tzabari, Gili
2006-08-08 18:55:41 UTC
Permalink
Hi,

I read the tutorial on how to create new Tasks but I am unsure how
my custom task can define new properties in its execute() that would then be
visible to the rest of the Ant script. Also, how can my Ant task invoke
other Ant tasks? If I could invoke <property> from inside my execute() it
would solve my problem.

Thank you,
Gili
Chun Ji
2006-08-08 19:10:21 UTC
Permalink
google "antcallback"

-cji

-----Original Message-----
From: Tzabari, Gili [mailto:***@nuance.com]
Sent: Tuesday, August 08, 2006 11:56 AM
To: Ant Users List
Subject: Custom Task that exports a property
Importance: Low


Hi,

I read the tutorial on how to create new Tasks but I am unsure how
my custom task can define new properties in its execute() that would then be
visible to the rest of the Ant script. Also, how can my Ant task invoke
other Ant tasks? If I could invoke <property> from inside my execute() it
would solve my problem.

Thank you,
Gili

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@ant.apache.org
For additional commands, e-mail: user-***@ant.apache.org
Tzabari, Gili
2006-08-08 19:12:41 UTC
Permalink
Actually I think I was looking for project.setNewProperty() which I
just ran into now :) I guess one uses AntCallback for chaining calls?

Thanks,
Gili
-----Original Message-----
From: Chun Ji [mailto:***@pro-unlimited.com]
Sent: Tuesday, August 08, 2006 3:10 PM
To: Ant Users List
Subject: RE: Custom Task that exports a property


google "antcallback"

-cji

-----Original Message-----
From: Tzabari, Gili [mailto:***@nuance.com]
Sent: Tuesday, August 08, 2006 11:56 AM
To: Ant Users List
Subject: Custom Task that exports a property
Importance: Low


Hi,

I read the tutorial on how to create new Tasks but I am unsure how
my custom task can define new properties in its execute() that would then be
visible to the rest of the Ant script. Also, how can my Ant task invoke
other Ant tasks? If I could invoke <property> from inside my execute() it
would solve my problem.

Thank you,
Gili

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

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@ant.apache.org
For additional commands, e-mail: user-***@ant.apache.org
Rebhan, Gilbert
2006-08-09 06:31:56 UTC
Permalink
Hi,

beside =
project.setNewProperty() for a really new property

there's also =
project.setProperty() - with that method you can reset/overwrite
an existing property if you need to

btw you can always use such methods with <script> task, you
don't always need a new task, f.e.

<property name="FOO" value="bla" />

<target name="reset">

<!-- groovy -->
<groovy>
ant.project.setProperty("FOO","blabla");
</groovy>

<echo>Reset $${FOO} Nr.1 via Groovy >>> ${FOO}</echo>

<!-- javascript -->
<script language="javascript">
<![CDATA[
// overwrite property
reset.setProperty("FOO","blablabla");
// new Property
project.setNewProperty("MyNewProperty", "foobar");
]]>
</script>

<echo>Reset $${FOO} Nr.2 via JavaScript >>> ${FOO}</echo>
<echo>$${MyNewProperty} >>> ${MyNewProperty} </echo>


Regards, Gilbert


-----Original Message-----
From: Tzabari, Gili [mailto:***@nuance.com]
Sent: Tuesday, August 08, 2006 9:13 PM
To: Ant Users List
Subject: RE: Custom Task that exports a property


Actually I think I was looking for project.setNewProperty()
which I
just ran into now :) I guess one uses AntCallback for chaining calls?

Thanks,
Gili
-----Original Message-----
From: Chun Ji [mailto:***@pro-unlimited.com]
Sent: Tuesday, August 08, 2006 3:10 PM
To: Ant Users List
Subject: RE: Custom Task that exports a property


google "antcallback"

-cji

-----Original Message-----
From: Tzabari, Gili [mailto:***@nuance.com]
Sent: Tuesday, August 08, 2006 11:56 AM
To: Ant Users List
Subject: Custom Task that exports a property
Importance: Low


Hi,

I read the tutorial on how to create new Tasks but I am unsure
how
my custom task can define new properties in its execute() that would
then be
visible to the rest of the Ant script. Also, how can my Ant task invoke
other Ant tasks? If I could invoke <property> from inside my execute()
it
would solve my problem.

Thank you,
Gili

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

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

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@ant.apache.org
For additional commands, e-mail: user-***@ant.apache.org
Tzabari, Gili
2006-08-09 14:21:14 UTC
Permalink
Sorry but how do I invoke the <java> task from within my custom
task? You guys said to use <antcall> but I'm not clear on how to do this
using the programmatic API (as opposed to embedding code in the build.xml
file).

Thanks,
Gili
-----Original Message-----
From: Rebhan, Gilbert [mailto:***@huk-coburg.de]
Sent: Wednesday, August 09, 2006 2:32 AM
To: Ant Users List
Subject: RE: Custom Task that exports a property


Hi,

beside =
project.setNewProperty() for a really new property

there's also =
project.setProperty() - with that method you can reset/overwrite
an existing property if you need to

btw you can always use such methods with <script> task, you
don't always need a new task, f.e.

<property name="FOO" value="bla" />

<target name="reset">

<!-- groovy -->
<groovy>
ant.project.setProperty("FOO","blabla");
</groovy>

<echo>Reset $${FOO} Nr.1 via Groovy >>> ${FOO}</echo>

<!-- javascript -->
<script language="javascript">
<![CDATA[
// overwrite property
reset.setProperty("FOO","blablabla");
// new Property
project.setNewProperty("MyNewProperty", "foobar");
]]>
</script>

<echo>Reset $${FOO} Nr.2 via JavaScript >>> ${FOO}</echo>
<echo>$${MyNewProperty} >>> ${MyNewProperty} </echo>


Regards, Gilbert


-----Original Message-----
From: Tzabari, Gili [mailto:***@nuance.com]
Sent: Tuesday, August 08, 2006 9:13 PM
To: Ant Users List
Subject: RE: Custom Task that exports a property


Actually I think I was looking for project.setNewProperty()
which I
just ran into now :) I guess one uses AntCallback for chaining calls?

Thanks,
Gili
-----Original Message-----
From: Chun Ji [mailto:***@pro-unlimited.com]
Sent: Tuesday, August 08, 2006 3:10 PM
To: Ant Users List
Subject: RE: Custom Task that exports a property


google "antcallback"

-cji

-----Original Message-----
From: Tzabari, Gili [mailto:***@nuance.com]
Sent: Tuesday, August 08, 2006 11:56 AM
To: Ant Users List
Subject: Custom Task that exports a property
Importance: Low


Hi,

I read the tutorial on how to create new Tasks but I am unsure
how
my custom task can define new properties in its execute() that would
then be
visible to the rest of the Ant script. Also, how can my Ant task invoke
other Ant tasks? If I could invoke <property> from inside my execute()
it
would solve my problem.

Thank you,
Gili

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

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

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


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

Loading...