Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sujithkrishnan

macrumors 6502
Original poster
May 9, 2008
265
0
Bangalore
How to execute custom ant task in Mac OS x? The exact problem i am facing is that i have developed a custom ant task and calling that task in my ant script.

This is the error that is displayed:

$ ant -buildfile test.xml
Buildfile: test.xml

BUILD FAILED
/Users/sujithkrishnan/Desktop/test.xml:11: taskdef A class needed by class com.digby.api.ProjectBuilder cannot be found: org/apache/tools/ant/Task

Total time: 0 seconds

ProjectBuilder is my class where i am using the ant's class which is org.apache.tools.ant.Task.

My CLASSPATH is also correctly set as shown below:

sujith-krishnans-mac-mini:Desktop sujithkrishnan$ echo $CLASSPATH
/usr/share/ant/lib/ant.jar


This class was developed in windows machine with ant 1.6.4 and java 1.5.0_08

The mac os is having java 1.5.0 and ant 1.7.0.

Any solutions will be highly appreciated.
 

pbw

macrumors newbie
May 18, 2006
12
0
How to execute custom ant task in Mac OS x? The exact problem i am facing is that i have developed a custom ant task and calling that task in my ant script.

This is the error that is displayed:

$ ant -buildfile test.xml
Buildfile: test.xml

BUILD FAILED
/Users/sujithkrishnan/Desktop/test.xml:11: taskdef A class needed by class com.digby.api.ProjectBuilder cannot be found: org/apache/tools/ant/Task

Total time: 0 seconds

ProjectBuilder is my class where i am using the ant's class which is org.apache.tools.ant.Task.

My CLASSPATH is also correctly set as shown below:

sujith-krishnans-mac-mini:Desktop sujithkrishnan$ echo $CLASSPATH
/usr/share/ant/lib/ant.jar


This class was developed in windows machine with ant 1.6.4 and java 1.5.0_08

The mac os is having java 1.5.0 and ant 1.7.0.

Any solutions will be highly appreciated.

You have to define a classpath for the custom task in the build.xml file. See the docs for Taskdef and Typedef in the Tasks section of the Ant documentation. There are "classpath" and "classpathref" attributes available to the "taskdef" through its inheritance from Typedef.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.