Search code examples
eclipsemavendependenciesosgi-bundlep2

can we use dependencies from Eclipse p2 repository in a regular Maven build


I have a maven project with packaging type as jar . I have loads of normal dependencies which are present in m2 repository and some eclipse bundle dependencies which are present in p2 repo. I can not use tycho compiler plugin as it will prohibit me from using m2 repo dependencies. I tried adding p2 repository in pom.xml and add dependency in dependency tag -

<repositories>
   <repository>
       <id>test</id>
       <layout>p2</layout>
       <url>file:///C:/repo/test</url>
   </repository>
</repositories>

But its giving me error -

Failed to execute goal on project test-common: Could not resolve dependencies for project 
com.test.ce:test-common:jar:0.0.1: Failed to collect dependencies at
com.test.pd:com.pd.test.xml:jar:1.2.200.003: Failed to read artifact descriptor for 
com.test.pd:com.pd.test.xml:jar:1.2.200.003: Could not transfer artifact 
com.test.pd:com.pd.test.xml:jar:1.2.200.003 from/to test (file:///C:/repo/test): 
Cannot access file:///C:/repo/test with type p2 using the available connector factories: BasicRepositoryConnectorFactory: 
Cannot access file:///C:/repo/test with type p2 using the available layout factories: Maven2RepositoryLayoutFactory: 
Unsupported repository layout p2 -> [Help 1]

Solution

  • You can resolve the Eclipse dependencies from Maven Central (maven.org) or some other Maven repositories (like mvnrepository.com) for straight Maven builds.

    For example, you can find org.eclipse.core here.

    Occasionally, some versions are not available on Maven Central, so you might have to try and find another compatible version.

    This article provides some background information.