A few different options...
P2 plugin
Use p2-maven-plugin to wrap all your non-OSGi dependencies into bundles, and create a p2 repository.
I haven't tried p2-maven-plugin (it didn't exist when I was setting up my current project). Its implementation is based on tycho, but you may find it provides a more convenient way to solve your problem than just the tycho plugins on their own.
Bundle plugin
Use maven-bundle-plugin to wrap your non-OSGi dependencies (one wrapper pom per dependency), and install it into your repository. I think commons-math is already a dependency, so you might just need to wrap vecmath. You could then list those dependencies in the <dependencies>
of your tycho-based pom files.
This approach has the advantage that you don't need to set up a p2 repository just to build your project. The disadvantage is that managing dependencies in your bundle projects is no longer a case of just modifying the MANIFEST.MF file: you might also need to update the pom too.
Bundle plugin and Tycho
If you use the Bundle plugin approach to wrapping your dependencies into OSGi bundles, it may still be useful to set up a p2 repository for those dependencies anyway, as this simplifies setting up the target platform in Eclipse PDE.
To do this, you can create a new tycho-based project to collect the dependencies into a p2 repository: that is, the dependencies that are already bundles, together with the wrapped versions of the non-OSGi dependencies. This way, the project that creates the p2 repository lists the wrapped dependencies in its pom, and your bundle projects can consume the p2 repository without listing any dependencies in their poms.
This is the approach I am using. Specifically, I am using an eclipse-feature
project to define a base feature which includes all the third-party dependencies. I also have the <deployableFeature>
configuration option on the packaging plugin set to true
, which will create a p2 repository in the target directory. This feature can be installed into my usual Eclipse instance, which makes it easy to use the current Eclipse platform as the target platform. It can also be used as a p2 repository that can be used elsewhere in the tycho build (i.e. by my code), or as a repository in an Eclipse .target
file.
The eclipse-feature
seemed to be the best packaging type in Tycho 0.13.0. There may be a more appropriate packaging type in more recent versions.