PDA

View Full Version : Executing a custom ant task in Mac OS X.




sujithkrishnan
Jun 25, 2009, 04:17 AM
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
Jul 2, 2009, 01:49 AM
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.