ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peter.rei...@corvil.com>
Subject Re: Article: Use Jython to Write Ant Tasks
Date Tue, 27 Apr 2004 11:37:06 GMT
Ed Taekema wrote:

>Interesting ... thanks for the new groovy code ... I am just getting up to speed on it
... Can you provide more details on the error?  Does it occur after the project.addTaskDefinition?

>  
>
Yes it happens when I do.
<s message="hello"/>

Peter

>Ed
>
>
>-----Original Message-----
>From: Peter Reilly <peter.reilly@corvil.com>
>Sent: Apr 26, 2004 3:50 AM
>To: Ant Users List <user@ant.apache.org>
>Subject: Re: Article:  Use Jython to Write Ant Tasks
>
>Hi Ed,
>This is a interresting article - I did not know about the """@sig " trick.
>
>I tried to do the following using ant's script task:
>
>from org.apache.tools.ant import Task
>
>class SimpleTask(Task):
>
>  message = ""
>
>  def execute(self):
>     """@sig public void execute()"""
>     Task.log(self, "Message: " + self.message)
>
>  def setMessage(this, aMessage):
>     """@sig public void setMessage(java.lang.String str)"""
>     this.message = aMessage
>
>project.addTaskDefinition("s", SimpleTask)
>
>But when the task is used, I get:
>ImportError: no module named main
>
>This is a pity as it would be nice to add jython to the
>languages supported by <scripttypedef>.
>
>
>The groovy example would be more  groovly  written:
>
>import org.apache.tools.ant.Task
>public class GroovySimpleTask extends Task {
>  String message = ""
>  public void execute() {
>    log(message)
>  }
>}
>
>project.addTaskDefinition("s", GroovySimpleTask)
>
>
>Peter
>
>
>Ed Taekema wrote:
>
>  
>
>>I've written a guide to writing Ant tasks using Jython:  how to add scripted behaviour
>>to ant builds. It details the steps to write a custom Ant task in jython, compile
>>it and install it into ant so it can be used as any other task in an ant build. 
>>The article also takes a quick look at an alternate implementation using Groovy.
>>
>>And ... here is the url:  http://www.pycs.net/users/0000177/stories/11.html .
>>
>>Enjoy,
>>
>>Ed Taekema
>>Toronto, Canada
>>
>>---------------------------------------------------------------------
>>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
>
>
>
>---------------------------------------------------------------------
>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


Mime
View raw message