I've created a view plug-in for Eclipse. I can export the jar from the project and it's working quite good. I'm trying to create an Ant build script to automate it.

I've created two Ant build scripts from Eclipse by doing

  1. Right click the project, Export, Antbuild files.
  2. By export wizard of the plugin, I choose "Save as ant script" in the options.

First one is quite long, it has init target, build target, ect. Second one is just the following:

<?xml version="1.0" encoding="UTF-8"?>
<project default="plugin_export" name="build">
    <target name="plugin_export">
        <pde.exportPlugins destination="C:\newPlugin" exportSource="false" exportType="directory" plugins="myplugin" useJARFormat="false"/>
    </target>
</project>

I tried to run both of them by the command line:

java -jar c:\eclipse\plugins\org.eclipse.equinox.launcher_*.jar -application org.eclipse.ant.core.antRunner -data C:\newPlugin -buildfile build_plugin.xml

If I run the long antbuild, it created the obj files under bin directory. That's good but I want the plugin jar file. I guess second one is supposed to do that. However, even though the build is successful I don't see any jar files.

Here's the ant script output:

Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Buildfile: build_plugin.xml
parsing buildfile C:\newPlugin\build_plugin.xml with URI = file:/C:/newPlugin/build_plugin.xml
Project base dir set to: C:\newPlugin
Build sequence for target(s) `plugin_export' is [plugin_export]
Complete build sequence is [plugin_export, ]

plugin_export:
parsing buildfile jar:file:/C:/eclipse/plugins/org.apache.ant_1.8.2.v20110505-1300/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/C:/eclipse/plugins/org.apache.ant_1.8.2.v20110505-1300/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
BUILD SUCCESSFUL

BUILD SUCCESSFUL
Total time: 2 seconds
有帮助吗?

解决方案

Your run looks correct. When I go through the same steps:

<project default="plugin_export" name="build">
        <target name="plugin_export">
                <pde.exportPlugins destination="/opt/pwebster/workspaces/deploymentTest" exportSource="false" exportType="directory" plugins="org.eclipse.core.expressions" qualifier="v201112061450" useJARFormat="true"/>
        </target>
</project>

and then run it:

bash$ eclipse/eclipse -noSplash \
-application org.eclipse.ant.core.antRunner 
-data /opt/pwebster/workspaces/build38x/ \
-buildfile build_file.xml

I get in my outout directory deploymentTest/plugins/org.eclipse.core.expressions_3.4.300.v201112061450.jar

Just a note: your destination should be a directory outside of your workspace, and you should pass your workspace into the call using -data

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top