Adding ant task from a plugin [message #306400] |
Thu, 27 July 2006 19:48  |
Eclipse User |
|
|
|
Originally posted by: ian._delete_kelman.com
Hi,
I'm trying to package XMLBeans as a plugin that automatically contributes
the <xmlbean> ant task for use within my Eclipse IDE. I have tried to
follow the instructions at the following link:
http://help.eclipse.org/help32/topic/org.eclipse.platform.do c.isv/guide/ant_contributing_task.htm
however, whenever I try to run an ant script that uses the <xmlbean> task
I always receive the message "Could not create task or type of type:
xmlbean".
I have, however, been able to explicitly update my Ant->Runtime
preferences with the necessary jars as Global Entries so that when I use
an <xmlbean> task ant automatically finds the XMLBean class within
xbean.jar. It would be much easier for our team, though, if we only
needed to install a feature that included a plugin that extended ant
without any additional manual steps.
Here are the steps I have taken in trying to put together the desired
plugin:
1) Created plugin project org.apache.xmlbeans.
2) Added entire contents of xmlbeans-2.2.0 binary distribution as
downloaded from xmlbeans.apache.org.
3) Created a source folder ant-lib_src and added a copy of
org/apache/xmlbeans/impl/tool/XMLBean.java that I extracted from the
source distribution - and then renamed the class to EclipseXMLBean. The
reason I did this was to provide a task implementation in a separate jar
as specified in the eclipse help. Note that I also added the source
folder to the project.
4) In the Build properties I defined an ant-lib.jar to be built from
ant-lib_src, so the build.properties appears as follows:
bin.includes = META-INF/,\
plugin.xml,\
lib/,\
schemas/,\
...other folders and files...
ant-lib.jar
jars.compile.order = ant-lib.jar
source.ant-lib.jar = ant-lib_src/
output.ant-lib.jar = bin/
5) I added an <antTask> extension which appears in plugin.xml as follows:
<extension point="org.eclipse.ant.core.antTasks">
<antTask
class="org.apache.xmlbeans.impl.tool.EclipseXMLBean"
headless="true"
library="ant-lib.jar"
name="xmlbean"/>
</extension>
6) Updated the manifest to include all the XMLBeans jars as part of the
Bundle-Classpath, and to require bundles org.eclipse.ant.core and
org.apache.ant in Require-Bundle. Here's the full content of MANIFEST.MF,
just in case:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Apache XMLBeans IDE Plug-in
Bundle-SymbolicName: org.apache.xmlbeans;singleton:=true
Bundle-Version: 2.2.0
Bundle-ClassPath: lib/xbean.jar,
lib/jsr173_1.0_api.jar,
lib/xbean_xpath.jar,
lib/resolver.jar,
lib/xmlpublic.jar
Bundle-Vendor: kelman.com
Bundle-Localization: plugin
Export-Package: org.apache.xmlbeans
Require-Bundle: org.eclipse.ant.core,
org.apache.ant
Bundle-RequiredExecutionEnvironment: J2SE-1.4
7) Exported my deployable plugin as a folder rather than a jar and copied
it into my eclipse installation's plugin folder.
8) Restarted Eclipse and ran the following simple test build script:
<project name="Test_xmlbeans_ant_task" default="test">
<target name="test">
<xmlbean schema="schemas/nameworld.xsd"
destfile="test_nameworld.jar"
debug="on" />
</target>
</project>
9) Got the error "Could not create task..."
If you might be able to help figure out what I'm missing I'd be glad to
send you the whole project - zipped it's about 3.6M. Just note that you
have to remove "_delete_" from my e-mail address.
Thanks,
Ian
|
|
|
Re: Adding ant task from a plugin [message #306442 is a reply to message #306400] |
Fri, 28 July 2006 15:59  |
Eclipse User |
|
|
|
Originally posted by: ian._delete_kelman.com
After way too many hours tweaking little classpath issues every which way,
I finally discovered I had missed the obvious: the newly added task is
only available if I check "Run in the same JRE as the workspace" for my
build script. Doh!
Thanks for any effort you spent trying to figure out where I was going
wrong.
Ian
|
|
|
Powered by
FUDForum. Page generated in 0.25277 seconds