What is a p2 repository?
Asked Answered
T

1

22

I'm working on a project now for a few months where we use "p2-repositories". I know that I get my dependencies from them. But now I want do dive deeper into the subject and I wonder what exactly is a p2-repository - the definition.

I think it has something to do with OSGi and with Nexus. But where does it come from? Am I bound to Nexus when I use p2 repositories? Or is this the common standard from OSGi? Or Eclipse/Maven/Tycho?

Why do I need p2-repositories, when I can have Maven? Or why can't I use Maven?

Tireless answered 10/5, 2017 at 14:51 Comment(3)
They are part of the Eclipse/Equinox provisioning platform see here and here. p2 because it is the second provisioning platform Eclipse has used.Serous
Tycho uses to resolve OSGi artifacts P2 repositories. The point is the project is working MANIFEST based or pom based. The MANIFEST way is the more OSGi oriented way where as the pom based is the Maven related way....Solitude
help.eclipse.org/neon/…Alannaalano
A
21

P2 repositories are very common in the eclipse ecosystem. They combine the artifacts (bundles), the meta data and can also contain eclipse features.

P2 repositories are generally completely independent of maven repositories and nexus. Nexus has some support for p2 features which is probably the connection you have with it.

Another way of providing deployments in OSGi is using Apache Karaf features. These list the bundles to install as urls to each bundle. Such a url can also be a mvn url with maven coordinates. In this case the features as well as the bundles are located in maven.

A third way is to use OSGi bundle repositories. This is an OSGi standard and is used in bndtools. They just host the index of the meta data and a url to the bundle. It can be integrated with maven.

Unfortunately these ways of deployment are mutually exclusive. So you best use the one that is the most prominent for the platform you develop on. So for example if almost all of your dependencies are from eclipse projects then p2 is natural.

Actin answered 10/5, 2017 at 15:24 Comment(2)
bndtools now supports p2, OSGi, and maven repositories as first class citizensSterilant
Artifactory has full support for p2 repositories: jfrog.com/confluence/display/RTF/P2+RepositoriesFlytrap

© 2022 - 2024 — McMap. All rights reserved.