3

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
Jonathan Spooner
  • 7,682
  • 2
  • 34
  • 41
Halil
  • 2,076
  • 1
  • 22
  • 30

1 Answers1

3

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

Paul Webster
  • 10,614
  • 1
  • 25
  • 32
  • That's weird and promising. Even though I create a dummy project and run the command line I still don't get anything. Do I miss something on eclipse? I use Eclipse SDK 4.1.0. I'll have a fresh installation and try it again. I would be glad to hear if you have any other ideas. – Halil Dec 06 '11 at 20:36
  • Paul, could that be the plugin that eclipse created while you're trying to get build.xml? I've just tried the same dummy project in my home machine (downloaded latest java and eclipse) but no luck. I still cannot do headless build. Could that be a bug? – Halil Dec 07 '11 at 01:15
  • Are you using different directories for your workspace with your project and your deployment directory? Are you passing in the workspace with the project in your -data? – Paul Webster Dec 07 '11 at 15:04
  • Oh my, I give the path of the project all the time, not the workspace path. Now it works. Thanks a lot! – Halil Dec 07 '11 at 18:26
  • It is not practical for me to have to supply a workspace with -data if I simply want the plugin to be built. Is there any way to do this without specifying a workspace? – Markus Apr 25 '16 at 11:42
  • PDE can only build plugins in the context of a workspace (that can already compile that plugin). If you want to build some plugins/features without involving PDE, have a look at http://www.eclipse.org/tycho/ which works with maven. – Paul Webster Apr 30 '16 at 01:49