Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

hstaudacher/tycho-karaf-bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 

Repository files navigation

tycho-karaf-bridge

kar-packager: The kar-packager is a small Maven Plugin to create Apache Karaf Archives (.kar) from a given folder. Everything the folder needs to contain are the bundles to make up the archive.

The reason this plugin was created is simple. When you come from the Eclipse-OSGi world you are familiar with p2. When you come form the Apache-OSGi world you are familiar with Maven. When you want to use an Eclipse Tycho build to produce a Karaf Archive without giving up the Eclipse way you are completely lost! The purpose of this plugin is to bridge the gap between the two worlds, at least for creating Karaf Archives ;).

Usage

In your parent pom enable the plugin:

<build>
  <plugins>
    ...
    <plugin>
      <groupId>com.eclipsesource.tycho.karaf.bridge</groupId>
      <artifactId>kar-packager</artifactId>
      <version>0.6.0</version>
      <extensions>true</extensions>
    </plugin>
    ...
  </plugins>
</build>

In the module you want to create the kar archive create a pom with the packaging typ kar as followed:

...
<packaging>kar</packaging>
<build>
  <plugins>
    <plugin>
      <groupId>com.eclipsesource.tycho.karaf.bridge</groupId>
      <artifactId>kar-packager</artifactId>
      <version>0.6.0</version>
      <configuration>
        <bundlesFolder>${PATH_TO_A_FOLDER_CONTAINING_BUNDLES}</bundlesFolder>
        <featureName>${YOUR_FEATURE_NAME}</featureName>
        <featureVersion>${YOUR_FEATURE_VERSION}</featureVersion>
        <featureDescription>${YOUR_FEATURE_DECRIPTION}</featureDescription>        
        <karFile>${NAME_OF_THE_KAR_ARCHIVE_WITHOUT_.kar}</karFile>
      </configuration>
    </plugin>
  </plugins>
</build>
...

As you can see the plugin needs to be configured with two properties. The first is the location of the folder which contains all bundles. The second is the name of the Apache Karaf Archive without the .kar extension.

The kar-packaer also allows additional configuration for bundles, feature dependencies and config admin properties within the configuration section.

Configure bundles:

...
  <groupId>com.eclipsesource.tycho.karaf.bridge</groupId>
  <artifactId>kar-packager</artifactId>
  <version>0.6.0</version>
  <configuration>
    <bundlesFolder>${PATH_TO_A_FOLDER_CONTAINING_BUNDLES}</bundlesFolder>
    <featureName>${YOUR_FEATURE_NAME}</featureName>
    <featureVersion>${YOUR_FEATURE_VERSION}</featureVersion>
    <featureDescription>${YOUR_FEATURE_DECRIPTION}</featureDescription>
    <karFile>${NAME_OF_THE_KAR_ARCHIVE_WITHOUT_.kar}</karFile>
    <bundlesConfiguration>
      <bundleConfiguration>
        <name>some.bundle.synbolic.name</name>
        <startLevel>70</startLevel>
        <autoStart>false</autoStart> // optional, default is true
      </bundleConfiguration>
      ...
    </bundlesConfiguration>
  </configuration>
...

Configure Feature dependencies:

...
  <groupId>com.eclipsesource.tycho.karaf.bridge</groupId>
  <artifactId>kar-packager</artifactId>
  <version>0.6.0</version>
  <configuration>
    <bundlesFolder>${PATH_TO_A_FOLDER_CONTAINING_BUNDLES}</bundlesFolder>
    <featureName>${YOUR_FEATURE_NAME}</featureName>
    <featureVersion>${YOUR_FEATURE_VERSION}</featureVersion>
    <featureDescription>${YOUR_FEATURE_DECRIPTION}</featureDescription>
    <karFile>${NAME_OF_THE_KAR_ARCHIVE_WITHOUT_.kar}</karFile>
    <bundlesConfiguration>
      <featureDependencies>
        <featureDependency>
          <name>feature.name</name>
          <versionRange>optional.version.range</versionRange>
        </featureDependency>
        ...
      </featureDependencies>
    </bundlesConfiguration>
  </configuration>
...

Configure properties for the config admin:

...
  <groupId>com.eclipsesource.tycho.karaf.bridge</groupId>
  <artifactId>kar-packager</artifactId>
  <version>0.6.0</version>
  <configuration>
    <bundlesFolder>${PATH_TO_A_FOLDER_CONTAINING_BUNDLES}</bundlesFolder>
    <featureName>${YOUR_FEATURE_NAME}</featureName>
    <featureVersion>${YOUR_FEATURE_VERSION}</featureVersion>
    <featureDescription>${YOUR_FEATURE_DECRIPTION}</featureDescription>
    <karFile>${NAME_OF_THE_KAR_ARCHIVE_WITHOUT_.kar}</karFile>
    <bundlesConfiguration>
      <configAdmin>
        <config>
          <name>org.ops4j.pax.web</name>
          <key>org.osgi.service.http.port</key>
          <value>9090</value>
        </config>
        ...
      </configAdmin>
    </bundlesConfiguration>
  </configuration>
...

Installation

Available in Maven Central.

License

All code in com.eclipsesource.* packages is published under the terms of the Eclipse Public License, version 1.0. All code in com.crsn.maven.* packages is published under the terms of the GPL3 and was taken and modified from the maven-osgi-repo Google Code Project.

About

Maven Plugins to bridge the gap between Eclipse Tycho and Apache Karaf

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages