how to add an anttask to an eclipse plugin [message #325971] |
Tue, 04 March 2008 10:45 |
Eclipse User |
|
|
|
I'm trying to make some plugin functionality available as an ant task in
my plugin.
I have built a fully functional ant task that works when copied in into
$ANT_HOME/lib and declared with:
<taskdef name="mytask classname="com.fold1.MyTask"
classpath="${env.ANT_HOME}/lib/ant-mytask.jar" />
I have declared extension points in my plugin.xml like:
<extension point="org.eclipse.ant.core.antTasks">
<antTask
class="com.fold1.MyTask"
eclipseRuntime="true"
headless="true"
library="lib/ant-mytask.jar"
name="mytask">
</antTask>
</extension>
I've seen this one as well in PDE but I'm not sure whether I need it...
<extension
point="org.eclipse.ant.core.extraClasspathEntries">
<extraClasspathEntry
eclipseRuntime="false"
headless="true"
library="lib/ant-mytask.jar">
</extraClasspathEntry>
</extension>
When I run it I get an exception:
Could not load class (com.fold1.MyTask) for type mytask
BUILD FAILED
/Users/maarten/workspace-fold1/sli-fold1-insaver-he/build.xm l:54:
Problem: failed to create task or type mytask
Cause: the class com.fold1.MyTask was not found.
Action: Check that the component has been correctly declared
and that the implementing JAR is in one of:
-/Applications/eclipse34/plugins/org.apache.ant_1.7.0.v20071 1021030/lib
-/Users/maarten/.ant/lib
-a directory added on the command line with the -lib argument
Do not panic, this is a common problem.
It may just be a typographical error in the build file or the task/type
declaration.
The commonest cause is a missing JAR.
This is not a bug; it is a configuration problem
at
org.apache.tools.ant.UnknownElement.getNotFoundException(Unk nownElement.java:481)
at org.apache.tools.ant.UnknownElement.makeObject(UnknownElemen t.java:413)
at
org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownEl ement.java:160)
at org.apache.tools.ant.Task.perform(Task.java:347)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.ja va:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298 )
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(D efaultExecutor.java:41)
at
org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.exe cuteTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:118 1)
at
org.eclipse.ant.internal.core.ant.InternalAntRunner.run(Inte rnalAntRunner.java:623)
at
org.eclipse.ant.internal.core.ant.InternalAntRunner.run(Inte rnalAntRunner.java:456)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.ant.core.AntRunner.run(AntRunner.java:377)
at
org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDe legate$1.run(AntLaunchDelegate.java:247)
at java.lang.Thread.run(Thread.java:613)
I have set the external program to run in the same JRE as Eclipse, the
task appears in Preferences/Ant/Runtime
How can I get this to work?
|
|
|
Powered by
FUDForum. Page generated in 0.03131 seconds