I’m not hip when it comes to building Eclipse based products. I still use plain vanilla PDE Build. The cool guys all switched to Tycho. Well, you’re allowed to call me dinosaur then. Anyway, I’ve been using .target
files as a source for dependency management for quite a while now. They are very useful in Eclipse. All dependencies for all the bundles are defined in one place. You simply open one and Eclipse starts downloading one half of the Internet. Maven already did the other half, I’ve heard.
I also use them to drive PDE Build. Instead of specifying stuff to fetch for a build again I simply point PDE Build to the same .target
file I use in the IDE. Works like a charm as long as you only use “Software Sites” (p2 repositories) which are accessible via URL by any developers Eclipse instance as well as the build machine.
Previously, this was implemented by transforming the .target
file XML using XSL into an Ant script. The Ant script did a bunch of p2 mirror calls to download the bytes. I recently upgrade to a newer version of the builder containing a Juno version of the org.eclipse.pde.core bundle. Starting with 3.8 this bundle defines a nice Ant task that does not require the XSLT magic.
<target name="buildTargetPlatform" unless="skipTargetDefinition"> <!-- note: this requires pde.core (from Juno) in the base builder --> <pde.provisionTargetDefinition targetFile="/path/to/my.target" destinationDirectory="${repoBaseLocation}/target" clearDestination="false"/> </target>
Thanks for sharing. I didn’t know it was possible to use the .target file directly. Was the XSL file you mentioned part of PDE build or did you write it yourself?
Quite some time ago someone published this approach. I took the XSL file and adapted it out our needs. It’s still available here.
Hi, does this Ant task still works with Eclipse SDK 4.12? I tried it similar to your example but Ant is unable to find the task definition for pde.provisionTargetDefinition. Did I miss some configuration that I need to do? Also I would like to verify if this is applicable also for PDE headless builds.
I don’t think so. I stopped using PDE Build a long time ago. I believe it’s no longer maintained/supported.
There is a caveat with this task: When including a fragment with MANIFEST.MF Eclipse-BundleShape: dir the task will export it as directory instead of a jar. So when using this exported target via maven, results like
Artifact osgi.bundle,org.eclipse.equinox.launcher.gtk.linux.x86_64,1.2.100.v20210209-1541 is a folder but the repository is an archive or remote location.
may appear. It seems like there should be an option like “ignoreBundleShape” to keep the resp. files as jars not unpacking them.