Eclipse PDE and Maven Bundle Plugin
To get eclipse PDE working hand in hand with Maven is a rather tricky task. I have already written about some necessary tweaks to get it working.
Another way is to use the Apache Felix Maven bundle plugin. This Maven plugin is able to generate the necessary files for the eclipse PDE to work with the Maven files. It does so by copying the JARs that the Maven project depends on and by altering the .classpath and .project files of the project.
I found that this procedure works fine with eclipse projects, which are already linked to eclipse IAM and have been created as eclipse plugin projects.
Copying Maven Dependencies
The Maven dependencies are directly copied to the project‘s main folder. The dependencies are the jars in the following screenshot.
This must be configured in the project‘s pom.xml file. (1)
(3) Add a Maven clean plugin to remove those copied dependencies
(4) Add a plugin to configure the bundles manifest file. I think the syntax to create these files using the plugin is quite verbose and rather use the PDE tools for generating a bundle. Therefore, the plugin basically just copies the MANIFEST.MF edited with eclipse.
Classpath entries such as the following are created to link to the Maven dependencies:
A comment is added to the project description
(for me it seemed to work fine with eclipse iam.
and a number of linked resources
I am not too happy about the absolute paths used here. These require a different .project file on each workstation. However, the .project file can be fairly easy created with the Maven Bundle Plugin.
mvn clean package eclipse:eclipse -Declipse.pde install
Sometimes it is better to call mvn eclipse:clean clean package eclipse:eclipse -Declipse.pde install as otherwise the classpath is not created correclty.