Question

I have an osgi-bundle which is created by using the maven-bundle-plugin:

<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <configuration>
    <instructions>
      <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
    </instructions>
  </configuration>
</plugin>

The bundle is installed via the maven-sling-plugin.

I have a fasterxml.jackson dependency which exists as an osgi-bundle in my .m2 repo and acts as a dependency in my project.

How can I make maven deploy this dependency as an osgi-bundle as well?

At the moment I have to install it manually in my osgi-container.

<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-core</artifactId>
  <version>2.2.2</version>
</dependency>

EDIT:

Simplification:

How do I make maven realize that an osgi-bundle which I refer to as a dependency in my pom.xml shall be installed in the osgi-container along with the bundles that depend upon it?

Was it helpful?

Solution

You'll probably find its best to package your bundle as part of your application along with the /content, /apps portions of your application in the /apps/myapp/install folder will cause the libraries to be installed as bundles by the jcr installer provider.

There are a couple of ways of automating packaging/deployment of applications using maven described in these articles:

Alternatively, you could just use the CRXDE to place the bundles and then CRX Package Manager to test the approach, them move on to automated packaging later.

If you don't want to repackage the two OSGI bundles, you can use the sling maven plugin to install the jackson bundle directly

mvn org.apache.sling:maven-sling-plugin:install-file -Dsling.file=jackson-databind-2.2.2.jar
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top