Maven Eclipse Plugin and Eclipse PDE: The Right Configuration


As noted on the Maven Eclipse plugin website, a two additional plugins need to be added to the project‘s pom. These copy the dependencies‘ jar files into the project folder and remove them on the eclipse:clean command. I found it helpful to add a further antrun plugin, which copies the MANIFEST.MF file generated by the maven bundle plugin. Therewith, the following additions can be made to the pom.xml

                                                         maven\-dependency-plugin                                                                                                                           copy-dependencies                                                 process-sources                                                                                                          copy-dependencies                                                                                                                                                           ${basedir}                                                         false                                                         false                                                         true                                                                                                                                                                                                              maven\-clean-plugin                                 2.3                                                                                                                                                                                    ${basedir}                                                                                                                          \*.jar                                                                                                                  false                                                                                                                                                                                                              maven\-antrun\-plugin                                                                                                                           package                                                                                                          run                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          

Maven arguments

As mentioned before, Maven should be called with an additional argument to assure that the eclipse plugin does not attempt to define links between the eclipse plugins. One way of generating the eclipse meta-data is the following:

mvn eclipse:clean clean package eclipse:eclipse -Declipse.pde -Declipse.useProjectReferences=false install

Categories: java