Skip to content

Instantly share code, notes, and snippets.

@lburgazzoli
Last active November 30, 2015 12:24
Show Gist options
  • Save lburgazzoli/3e7dfd0cd959dc854e62 to your computer and use it in GitHub Desktop.
Save lburgazzoli/3e7dfd0cd959dc854e62 to your computer and use it in GitHub Desktop.
karaf-maven-plugin
  • build.xml
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">

    <packaging>bundle</packaging>

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.github.lburgazzoli</groupId>
    <artifactId>gradle-karaf-features-plugin</artifactId>
    <version>1.0.0</version>
    <name>gradle-karaf-features-plugin</name>

    <prerequisites>
        <maven>3.3</maven>
    </prerequisites>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <version.slf4j>1.7.11</version.slf4j>
        <version.camel>2.16.1</version.camel>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
                <version>${version.camel}</version>
        </dependency>

        <!-- logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${version.slf4j}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${version.slf4j}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.karaf.tooling</groupId>
                <artifactId>karaf-maven-plugin</artifactId>
                <version>4.0.3</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <id>generate-features-file</id>
                        <phase>package</phase>
                        <goals>
                            <goal>features-generate-descriptor</goal>
                        </goals>
                        <configuration>
                            <includeProjectArtifact>true</includeProjectArtifact>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.0.1</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${project.artifactId}</Bundle-Name>
                        <Export-Package>com.github.lburgazzoli.gradle.plugin.karaf.examples.*</Export-Package>
                    </instructions>
                </configuration>
                <executions>
                    <!--
                      This execution makes sure that the manifest is available
                      when the tests are executed
                    -->
                    <execution>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

</project>
  • feature.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="gradle-karaf-features-plugin">
    <feature name="gradle-karaf-features-plugin" description="gradle-karaf-features-plugin" version="1.0.0">
        <bundle>mvn:com.github.lburgazzoli/gradle-karaf-features-plugin/1.0.0</bundle>
        <bundle>mvn:org.apache.camel/camel-core/2.16.1</bundle>
        <bundle>mvn:com.sun.xml.bind/jaxb-core/2.2.11</bundle>
        <bundle>mvn:com.sun.xml.bind/jaxb-impl/2.2.11</bundle>
        <bundle>mvn:org.slf4j/slf4j-api/1.7.11</bundle>
        <bundle>mvn:org.slf4j/slf4j-simple/1.7.11</bundle>
    </feature>
</features>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment