带有 karaf-maven-plugin 的 StartupFeatures

StartupFeatures with karaf-maven-plugin

我正在尝试创建自己的 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 文件,所以它们不会启动。

我做错了什么?


这是我的 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>

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

其余功能已注册为 运行时间范围的启动功能,并且效果很好。

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