Hi,

I don't know if any of you work with OSGi in general and eclipse plugins in specific, but both technologies have gained a lot of momentum in recent years. Now with maven tycho finally available, OSGi, eclipse and maven are really starting to grow together more closely. Without getting into details, tycho resolves dependencies from both maven repositories and p2 repositories and allows you to easily deploy your OSGi bundles into a standard maven repository. This works great at build time, but as of now, not so great at development time. When developing OSGi bundles in eclipse, you typically define a 'Target Platform' that contains all your dependencies and eclipse uses this to automatically construct the classpath (very similar to what m2eclipse does in a typical maven project). Most of the time these Target Platform definitions consist of a list of remote p2 repositories and eclipse downloads the required bundles automatically on demand, again, very similar to the way it works with maven/m2eclipse. The problem is, eclipse only understands p2 repositories, not maven repositories. So if for example you want to compile your projects at development time against the OSGi bundles that are available in your maven repository (deployed by yourself with maven tycho, or from an external source like Spring Enterprise Repository), you simply cannot do it.
First you need to either
-download all files manually and add them to your target platform
-or create a p2 repository from all the bundles and put that somewhere on a webserver

None of the alternatives sound great to me. We already have an archiva running that contains all the bundles we need, so I'd rather not duplicate all the jars and put them somewhere else. So I had the idea of using the archiva consumer API to crawl an archiva repository and create the p2 repository files (artifacts.jar and content.jar) on-the-fly. Sort of like a p2 view on a maven repository. To my understanding Nexus Professional offers such a feature, but there is no open source equivalent to this.

Over the last few days I was working on this idea a little and actually have a working prototype now. Whenever a new artifact gets deployed in archiva, the bundle manifest (or eclipse feature.xml) is parsed and the information is appended to the content.jar and artifacts.jar that I create in the root folder of the archiva repository. That way you can use the archiva repository as a regular p2 repository/eclipse update site and install everything that's either an OSGi bundle, or an eclipse feature into your host eclipse or your target platform.

Sorry for the long background story, but now finally to my questions. I'd greatly appreciate if somebody could help me out with these: 1. I think this would be a very helpful feature for users of tycho and archiva and I'd like to make this (once finished) available as open source. I was wondering if this is something you'd be interested in hosting directly as an apache archiva component

2. I could not find a way in the consumer API to determine if the 'Process All Artifacts' checkbox in 'admin/repositories.action' was activated before the scan got triggered. A full scan is the perfect time to throw away the old artifacts.jar and content.jar, but if the checkbox is not activated, I end up with an incomplete repository. At the moment I have overridden isProcessUnmodified() and return true. That works, but is unfortunately very very expensive for this kind of consumer if the repository is reasonably large.

3. I also could not find a way to get an event when a file is deleted. How can a consumer find out when an artifact gets deleted? Especially with snapshots being always unique since maven 3, the p2 files will quickly explode when old snapshot entries don't get deleted regulary...

Thanks and best regards,
Johannes Utzig

Reply via email to