Maven dependencies in p2 project

105 views Asked by At

Let's consider the following projects:

  • Project1: uses Eclipse P2 Target Definition for dependencies
  • Project2: uses Maven repositories for dependencies

The problem: project1 requires a dependency which is present in project2 which comes from a Maven repository (and is not available in p2).

My workaround up to now is that I am exporting project2 as a jar with dependencies. Then, I add this jar to project1 and can access the dependency from there.

How could I do this in a better way?

2

There are 2 answers

1
Cesar Villasana On

What do you mean with a better way?, What do you think you are doing wrong?

The only way to use libraries or classes from external projects is by importing the package that contains them. In this case, i guess you made this package using (on your second project) mvn install, mvn package or similar, which is perfectly fine...

If you import to your first project the jar that you just created it is ok too!, there is no better way to do this unless you combine both projects and make them a single one.

0
ctron On

You could use Package Drone, an open source tool I am currently working on. If your maven dependencies are OSGi bundles, you can drop them into Package Drone and let it create a P2 repository from it. So you can re-use these Maven dependencies using P2.