如何将包添加到karaf自定义分发?

时间:2017-04-13 11:14:38

标签: apache-karaf karaf karaf-maven-plugin

我创建karaf自定义分发

<?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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.me</groupId>
    <artifactId>root-karaf</artifactId>
    <packaging>karaf-assembly</packaging>
    <name>${project.artifactId}</name>
    <version>4.0.4</version>
    <dependencies>
        <dependency>
            <groupId>org.apache.karaf.features</groupId>
            <artifactId>framework</artifactId>
            <version>4.0.4</version>
            <type>kar</type>
        </dependency>

        <dependency>
            <groupId>org.apache.karaf.features</groupId>
            <artifactId>standard</artifactId>
            <version>4.0.4</version>
            <classifier>features</classifier>
            <type>xml</type>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.karaf.tooling</groupId>
                <artifactId>karaf-maven-plugin</artifactId>
                <version>4.0.4</version>
                <extensions>true</extensions>
                <configuration>
                    <!-- no startupFeatures -->
                    <startupFeatures>

                    </startupFeatures>

                    <installedFeatures>
                    </installedFeatures>
                    <bootFeatures>
                        <feature>standard</feature>
                        <feature>eventadmin</feature>
                        <feature>scr</feature>
                    </bootFeatures>

                    <excludedArtifactIds>
                        <artifactId>slf4j-api</artifactId>
                    </excludedArtifactIds>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

现在我想创建示例包并添加到此分发或例如添加:<bundle>wrap:mvn:com.google.code.gson/gson/2.8.0</bundle> ti rhis Distribution。我揍了这个:

<bootFeatures>
                        <feature>standard</feature>
                        <feature>eventadmin</feature>
                        <feature>scr</feature>
                        <bundle>wrap:mvn:com.google.code.gson/gson/2.8.0</bundle>
                    </bootFeatures>

但是它不能正常工作

我创建了feature.xml并放入资源

<?xml version="1.0" encoding="UTF-8"?>
<features xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="platform-features"
          xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"
          xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.0.0 http://karaf.apache.org/xmlns/features/v1.0.0">

    <feature name="platform" version="${project.version}" install="auto">
        <details>Service Platform</details>
        <feature>test</feature>
    </feature>


    <feature name="test" version="4.0.4" install="auto">
        <bundle>mvn:com.google.code.gson/gson/2.8.0</bundle>
    </feature>
</features>

1 个答案:

答案 0 :(得分:0)

AFAIK您无法直接将捆绑包添加到<bootFeatures>。您应该创建包含此捆绑包的自己的功能,并将该功能添加到bootFeatures。此外,在创建功能时,您不需要wrap:部分! gson 2.8已经是一个OSGi包!

相关问题