ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hussein Badakhchani" <Hussein.Badakhch...@voca.com>
Subject Calling ant tasks from jython
Date Thu, 10 Aug 2006 12:27:34 GMT
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.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message