ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hussein Badakhchani" <Hussein.Badakhch...@voca.com>
Subject RE: Calling ant tasks from jython
Date Thu, 10 Aug 2006 15:31:47 GMT
I can call the depreciated Copyfile task without a problem. I guess ant
tasks need some boot strapping if they are to be used out side of ant.
Does anyone have an example of using an ant task in some custom Java
code, this might shed some light on what I need to do. 

-----Original Message-----
From: Hussein Badakhchani [mailto:Hussein.Badakhchani@voca.com] 
Sent: 10 August 2006 14:38
To: Ant Users List
Subject: RE: Calling ant tasks from jython

Thanks, your right that was a typo in my message. I still have the
error.

-----Original Message-----
From: Peter Reilly [mailto:peter.kitt.reilly@gmail.com] 
Sent: 10 August 2006 14:32
To: Ant Users List
Subject: Re: Calling ant tasks from jython

just a quick look:

    Mkdir.setDir(testDir)

should be mkdir.setDir(testDir)

Peter


On 8/10/06, Hussein Badakhchani <Hussein.Badakhchani@voca.com> wrote:
>
> Hello,
>
>
>
> I am calling a jython script from my build.xml file using the script
> task e.g:
>
>
>
> <script language="jython" src="tools/jython/antCallTest.py"/>
>
>
>
> I want to use ant tasks from antCallTest.py. While I don't seem to
have
> any problems retrieving my projects properties it seems that any call
I
> make to an ant task method requires an extra argument.
>
> For example:
>
>
>
> Script called from my build.xml file
>
>
>
> import org.apache.tools.ant.taskdefs.Mkdir as Mkdir
>
> import java.io.File as File
>
>
>
> # These calls all work file
>
> print "Ant Call Test"
>
> print project.getProperty('build.dir')
>
> print project.getName()
>
>
>
> testDir=File('./test')
>
> mkdir = Mkdir()
>
>
>
> # At this point I get the error
>
> Mkdir.setDir(testDir)
>
>
>
>
>
> Traceback (innermost last):
>
> File "<string>", line 10, in ?
>
> TypeError: setDir(): expected 2 args; got 1
>
>
>
>
>
> The setDir method only accepts 1 argument as per the api.
>
> I have tried passing in an instance of self but I get the following
> error:
>
>
>
> Mkdir.setDir(self, testDir)
>
>
>
> Traceback (innermost last):
>
>   File "<string>", line 10, in ?
>
> TypeError: setDir(): self arg can't be coerced to
>
>
>
> Jython does not tell me what object self cannot be coerced to!
>
>
>
> What am I missing here?
>
>
>
> Hussein Badakhchani
>
> Middleware Analyst
>
> Infrastructure Support
>
>
>
> Blog: http://dev2dev.bea.com/blog/hoos/
>
>
>
>
>
>
>
> *****************************************************
>
>     You can find us at www.voca.com
>
> *****************************************************
> This communication is confidential and intended for
> the exclusive use of the addressee only. You should
> not disclose its contents to any other person.
> If you are not the intended recipient please notify
> the sender named above immediately.
>
> Registered in England, No 1023742,
> Registered Office: Voca Limited
> Drake House, Three Rivers Court,
> Homestead Road, Rickmansworth,
> Hertfordshire, WD3 1FX
>
>
> This message has been checked for all email viruses by MessageLabs.
>


This message has been checked for all email viruses by MessageLabs.


This message has been checked for all email viruses by MessageLabs.

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


This message has been checked for all email viruses by MessageLabs.



This message has been checked for all email viruses by MessageLabs.

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


Mime
View raw message