使用karaf-maven-plugin的StartupFeatures

时间:2016-11-04 18:39:32

标签: java maven osgi apache-karaf karaf

我正在尝试创建自己的karaf发行版,现在我可以毫无问题地汇编我的功能,但我无法将它们注册到 startup.properties 使用推荐的标签。

<startupFeature>foo</startupFeature> This will result in the feature bundles
being listed in startup.properties at the appropriate start level and the bundles
being copied into the "system" internal repository. You can use feature_name
or feature_name/feature_version formats.

当我使用标签时,我收到以下错误:

[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.5:assembly (default-cli) on project winthor-karaf: Unable to build assembly: Unable to resolve root: missing requirement [root] osgi.identity; osgi.ide
ntity=winthor-core-servico; type=karaf.feature; filter:="(&(osgi.identity=winthor-core-servico)(type=karaf.feature))" -> [Help 1]

如果我在 startUpFeatures 标记之前使用 installedFeatures 标记,则错误消失,但功能包未在 startup.properties <注册/ strong>文件,所以他们不会启动。

我做错了什么?

这是我的pom的相关部分:

  <dependencies>
    <dependency>
      <groupId>org.apache.karaf.features</groupId>
      <artifactId>framework</artifactId>
      <version>4.0.5</version>
      <type>kar</type>
    </dependency>
    <dependency>
      <groupId>org.apache.karaf.features</groupId>
      <artifactId>standard</artifactId>
      <classifier>features</classifier>
      <version>4.0.5</version>
      <scope>runtime</scope>
      <type>xml</type>
    </dependency>
    <dependency>
      <groupId>org.apache.karaf.features</groupId>
      <artifactId>spring</artifactId>
      <classifier>features</classifier>
      <type>xml</type>
      <version>4.0.5</version>
      <scope>runtime</scope>
    </dependency>


    <dependency>
      <groupId>br.com.pcsist.winthor.core</groupId>
      <artifactId>winthor-core-features</artifactId>
      <version>1.0.0</version>
      <scope>runtime</scope>
      <classifier>features</classifier>
      <type>xml</type>
    </dependency>
    <dependency>
      <groupId>br.com.pcsist.winthor.core</groupId>
      <artifactId>winthor-autenticacao-features</artifactId>
      <version>1.0.0</version>
      <scope>runtime</scope>
      <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.5</version>
        <extensions>true</extensions>
        <configuration>
          <bootFeatures>
            <bootFeature>instance</bootFeature>
            <bootFeature>package</bootFeature>
            <bootFeature>log</bootFeature>
            <bootFeature>ssh</bootFeature>
            <bootFeature>aries-blueprint</bootFeature>
            <bootFeature>framework</bootFeature>
            <bootFeature>system</bootFeature>
            <bootFeature>feature</bootFeature>
            <bootFeature>shell</bootFeature>
            <bootFeature>management</bootFeature>
            <bootFeature>service</bootFeature>
            <bootFeature>jaas</bootFeature>
            <bootFeature>shell-compat</bootFeature>
            <bootFeature>deployer</bootFeature>
            <bootFeature>diagnostic</bootFeature>
            <bootFeature>wrap</bootFeature>
            <bootFeature>bundle</bootFeature>
            <bootFeature>config</bootFeature>
            <bootFeature>kar</bootFeature>
          </bootFeatures>
          <startupFeatures>
            <startupFeature>winthor-core-data</startupFeatur>
            <startupFeature>winthor-core-servico</startupFeature>
            <feature>winthor-autenticacao</feature>
          </startupFeatures>
        </configuration>
      </plugin>
    </plugins>
  </build>

1 个答案:

答案 0 :(得分:0)

我们使用不同的方法解决了我们的问题,我们发现 startup.properties 包在 bootFeatures之前运行,这在文档中并不清楚,所以我们使用我们的核心功能创建了一个简单的kar,并将其作为自定义karaf分发的编译范围引用。

其余功能已注册为运行时范围的引导功能,它就像一个魅力。

关于karaf-maven-plugin,似乎 startupfeatures 功能已被破坏。