Skip to content

Instantly share code, notes, and snippets.

@rocketraman
Last active April 4, 2018 13:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rocketraman/914c55ab8577c95d3408 to your computer and use it in GitHub Desktop.
Save rocketraman/914c55ab8577c95d3408 to your computer and use it in GitHub Desktop.
Karaf-maven-plugin example
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!-- ... -->
<packaging>karaf-assembly</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>${karaf.version}</version>
<extensions>true</extensions>
<configuration>
<javase>1.8</javase>
<distribution>org.apache.karaf.features:framework</distribution>
<framework>
<feature>framework</feature>
</framework>
<descriptors>
<!-- List descriptors here to asssemble -->
<descriptor>mvn:com.rocketraman.d1/.../xml/features</descriptor>
<!-- ... -->
</descriptors>
<blacklistPolicy>Fail</blacklistPolicy>
<blacklistedBundles>
<blacklistedBundle>spring;range="[2,3.2.14.RELEASE)"</blacklistedBundle>
</blacklistedBundles>
<installAllFeaturesByDefault>false</installAllFeaturesByDefault>
<startupFeatures>
<feature>framework</feature>
</startupFeatures>
<bootFeatures>
<!-- Karaf-provided -->
<feature>instance</feature>
<feature>package</feature>
<feature>log</feature>
<feature>ssh</feature>
<feature>aries-blueprint</feature>
<feature>system</feature>
<feature>feature</feature>
<feature>shell</feature>
<feature>management</feature>
<feature>service</feature>
<feature>jaas</feature>
<feature>diagnostic</feature>
<feature>bundle</feature>
<feature>config</feature>
<feature>kar</feature>
<feature>service</feature>
<!-- Internal -->
<feature>com.rocketraman.feature1</feature>
<!-- insert more here as needed ... -->
</bootFeatures>
<usePathPrefix>false</usePathPrefix>
</configuration>
<executions>
<execution>
<id>verify</id>
<phase>generate-resources</phase>
<goals>
<goal>verify</goal>
</goals>
<configuration>
<descriptors>
<!-- Note that verification (unlike assembly) needs the framework features here -->
<descriptor>mvn:org.apache.karaf.features/framework/${karaf.version}/xml/features</descriptor>
<!-- List descriptors here to asssemble -->
<descriptor>mvn:com.rocketraman.d1/.../xml/features</descriptor>
<!-- ... -->
</descriptors>
<features>
<!-- Verify all features that may be installed directly, others are transitive deps -->
<feature>com.rocketraman.feature1</feature>
<!-- insert more here as needed ... -->
</features>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>framework</artifactId>
<version>${karaf.version}</version>
<type>kar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.osgi</groupId>
<artifactId>spring-osgi-core</artifactId>
<version>${spring-osgi.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.rocketraman.d1</groupId>
<artifactId>features</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>features</classifier>
<type>xml</type>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment