Skip to content
cleanerx edited this page Dec 15, 2016 · 6 revisions

This page lists a few use cases and how to implement them with Package Drone

OSGi

Build with Tycho - use with P2

  • Create a new channel
  • Add the following aspects
  • Hasher
  • Mime
  • P2 Repository
  • OSGi
  • Create and assign at least one deploy group and key for this channel
  • Configure maven to deploy to http://yourserver:8080/maven/<channel-id>
  • Configure to use "deploy" as username and the deploy key as password
  • Only deploy the features and bundles, not the P2 repository itself
  • Consume the repository from the URL http://yourserver:8080/p2/<channel-id>

Note: Do not add the Tycho Cleaner or the P2 Meta Data Generator!

This setup will re-use the P2 metadata generated by Maven Tycho. It will also re-use the generated features, but not the categories!

If you would add the Tycho Cleaner then the meta data would be prevented from being uploaded. If you would add the P2 meta data generator, then the meta data would appear twice. If you would add both, you would simply have a difference scenario 😉

Build with Maven Bundle Plugin (Apache Felix, Bnd) - use with P2

  • Create a new channel
  • Add the following aspects
  • Hasher
  • Mime
  • P2 Repository
  • OSGi
  • P2 Metadata Generator
  • Eclipse Source Bundle
  • Add a P2 virtual feature artifact
  • Create and assign at least one deploy group and key for this channel
  • Configure maven to deploy to http://yourserver:8080/maven/<channel-id>
  • Configure to use "deploy" as username and the deploy key as password
  • Consume the repository from the URL http://yourserver:8080/p2/<channel-id>

If you deploy the source attachments with you OSGi bundles, then Package Drone will automatically attach them as sub-artifacts and create Eclipse source bundles.

Download from somewhere - use with P2

  • Create a new channel
  • Add the following aspects
  • Hasher
  • Mime
  • P2 Metadata Generator
  • P2 Repository
  • OSGi
  • Eclipse Source Bundle
  • Add a P2 virtual feature artifact
  • For each bundle, create a new artifact and upload the file
  • Change to the artifact details view and add the source attachment as a child artifact
  • Consume the repository from the URL http://yourserver:8080/p2/<channel-id>

Build with Tycho - use with OSGi R5 / Bndtools

  • Create a new channel
  • Add the following aspects
  • Hasher
  • Mime
  • OSGi
  • Tycho Cleaner
  • Create and assign at least one deploy group and key for this channel
  • Configure maven to deploy to http://yourserver:8080/maven/<channel-id>
  • Configure to use "deploy" as username and the deploy key as password
  • Consume the repository from the URL http://yourserver:8080/r5/<channel-id>

Import from Maven Central

  • Create a new channel
  • Add the following aspects:
  • Hasher
  • Mime
  • OSGi
  • P2 Repository
  • P2 Meta data generator
  • Eclipse Source Bundle
  • Press "import" in the channel
  • Select "Maven" as source
  • Enter the maven coordinates of a Maven artifact (e.g. "org.apache.mina:mina-core:2.0.9" for Apache Mina Core 2.0.9)
  • Check "With source"
  • Test and import
  • Consume the repository from the URL http://yourserver:8080/p2/<channel-id>

This will not only import the bundle JAR and create a P2 repository, but also convert the Maven source attachment directly into an Eclipse Source bundle.

If you want the bundle/plugin to appear in the Eclipse Software Dialog, you will need to create a generated feature:

  • Press "Add artifact" in the channel
  • Select "P2 Feature Generator"
  • Enter at least the ID and version
  • Press "Create"

Note: The artifact will be imported into the channel. But if the artifact is not an OSGi bundle, it will not show up in a OSGi based repositories (like P2 or R5).

Create an APT repository

  • Create a new channel
  • Add the following aspects
  • Mime
  • Hasher
  • Debian
  • APT Repository
  • Upload the ".deb" files to this channel
  • Configure APT to use deb http://yourserver:8080/apt/<channel-id> stable main or deb http://yourserver:8080/apt/<channel-name> stable main

Access P2 repository ZIP

So if the P2 repository is named "p2repo.zip", the channel is named "test" and you just always want the newest repository use: http://yourserver:8080/unzip/newestByName/test/p2repo.zip as P2 repository URL.

See also the book for other ways of selecting an artifact with the unzip plugin.

Unpack zipped P2 repository

Beside using the Unzip adapter, it is also possible to extract the bundles and features of a zipped P2 repository and let Package Drone create virtual artifacts. This will simply put virtual child artifacts below the repository artifact, which then are processed as if they were uploaded. OSGi meta data can be extracted and P2 or R5 meta data can be generated as well.

So the difference to the Unzip Adapter is that the artifacts are available for all features of Package Drone. It is also possible to upload two repository ZIPs and let Package Drone create P2 categories, referencing the correct categories and features.

  • Create a new channel
  • Add the following aspects
  • Mime
  • Hasher
  • OSGi
  • P2 Meta Data
  • P2 Repository
  • P2 Unzip Generator
  • Upload the zipped P2 repository (using maven, manually or import)
  • Consume the repository from the URL http://yourserver:8080/p2/<channel-id>