Use of the Copy task inside another Java task
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Renaud_Despinois
Posted On:   Thursday, June 5, 2003 01:29 AM

Hi ! I'm writing a custom copy task in Java and want to use the Ant-based copy task inside of it. I instanciate the Copy class, set the attributes I'm using and then call the execute method but I always get this error when running Ant: java.lang.NullPointerException: at org.apache.tools.ant.Task.log(Task.java:155) at org.apache.tools.ant.Task.log(Task.java:145) at org.apache.tools.ant.taskdefs.Copy.execute(Compiled Code) at RecursiveCopy.execute(Compiled Code) at org.apache.tools.ant.Target.execute(Compiled Code) at org.apache.tools.ant.Project.runTarget(Project.java:898) at org.apache.tools.ant.Project.executeTarget(Compiled Code)    More>>

Hi !
I'm writing a custom copy task in Java and want to use the Ant-based copy task inside of it. I instanciate the Copy class, set the attributes I'm using and then call the execute method but I always get this error when running Ant:


java.lang.NullPointerException:

at org.apache.tools.ant.Task.log(Task.java:155)

at org.apache.tools.ant.Task.log(Task.java:145)

at org.apache.tools.ant.taskdefs.Copy.execute(Compiled Code)

at RecursiveCopy.execute(Compiled Code)

at org.apache.tools.ant.Target.execute(Compiled Code)

at org.apache.tools.ant.Project.runTarget(Project.java:898)

at org.apache.tools.ant.Project.executeTarget(Compiled Code)

at org.apache.tools.ant.Project.executeTargets(Compiled Code)

at org.apache.tools.ant.Main.runBuild(Compiled Code)

at org.apache.tools.ant.Main.main(Main.java:149)


Can someone help me ??

Thanx !    <<Less

Re: Use of the Copy task inside another Java task

Posted By:   Anonymous  
Posted On:   Thursday, June 5, 2003 06:56 AM

A little design question: are you sure you have to write a new copy task? I had the same problem and now I wrote a selector. So what is your goal?


at org.apache.tools.ant.Task.log(Task.java:155): whithout knowing your source tree - maybe the project attribute is not set. Logging is done via Project´s log() method. Task is delegating that to Project.

Re: Use of the Copy task inside another Java task

Posted By:   Anonymous  
Posted On:   Thursday, June 5, 2003 04:19 AM

Here's a copy of Copy task's comment :

/**
* Base class for all tasks.
*
* Use Project.createTask to create a new task instance rather than
* using this class directly for construction.
*
* @see Project#createTask
*/
About | Sitemap | Contact