【问题标题】:karaf-maven-plugin: unable to resolve missing requirement osgi.cdikaraf-maven-plugin:无法解决缺少的需求 osgi.cdi
【发布时间】:2021-02-13 17:07:17
【问题描述】:

我在这里看到了几个类似的问题,但它们要么没有得到答复,要么没有与我的案例相关的解决方案。 我正在尝试使用karaf-maven-plugin 构建一个 Maven 项目。以下是 POM 的相关片段:

  <plugin>
    <groupId>org.apache.karaf.tooling</groupId>
    <artifactId>karaf-maven-plugin</artifactId>
    <version>${karaf.version}</version>
    <extensions>true</extensions>
    <executions>
      <execution>
        <id>karaf-assembly</id>
        <goals>
          <goal>assembly</goal>
        </goals>
        <phase>install</phase>
      </execution>
    </executions>
    <configuration>
      <javase>11</javase>
      <framework>framework</framework>
      <useReferenceUrls>true</useReferenceUrls>
      <archiveTarGz>false</archiveTarGz>
      <includeBuildOutputDirectory>false</includeBuildOutputDirectory>
      <installedBundles>
        <installedBundle>mvn:commons-lang/commons-lang/2.6</installedBundle>
        <installedBundle>mvn:org.apache.camel/camel-cxf/${camel.version}</installedBundle>
        <installedBundle>mvn:org.apache.cxf/cxf-rt-frontend-jaxrs/3.4.0</installedBundle>
        <installedBundle>mvn:javax.enterprise/cdi-api/2.0</installedBundle>
        <installedBundle>mvn:javax.transaction/javax.transaction-api/1.2</installedBundle>
      </installedBundles>
      <bootFeatures>
        <feature>bundle</feature>
        <feature>config</feature>
        <feature>diagnostic</feature>
        <feature>feature</feature>
        <feature>jaas</feature>
        <feature>shell</feature>
        <feature>log</feature>
        <feature>management</feature>
        <feature>package</feature>
        <feature>shell-compat</feature>
        <feature>ssh</feature>
        <feature>system</feature>
        <feature>wrap</feature>
        <feature>scr</feature>
      </bootFeatures>
      <startupFeatures>
        <feature>framework</feature>
        <feature>aries-blueprint</feature>
        <feature>camel-core</feature>
        <feature>camel-blueprint</feature>
      </startupFeatures>
      <startupBundles>
        <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version};start-level=80</bundle>
      </startupBundles>
    </configuration>
  </plugin>

尝试构建,引发以下异常:

[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.2.8:assembly
(karaf-assembly) on project ...: Unable to build assembly: Unable to resolve root:  missing
requirement [root] osgi.identity; osgi.identity=...; type=osgi.bundle;  version="
[1.0.1,1.0.1]"; resolution:=mandatory [caused by: Unable to resolve press-  release2/1.0.1:
missing requirement [press-release2/1.0.1] osgi.extender;  beans=...; filter:="
(&(osgi.extender=osgi.cdi)(version>=1.0.0)(!(version>=2.0.0)))"] -> [Help 1]

那么,显然发生的事情是没有安装 CDI 的 OSGI 扩展器 (osgi.cdi)。我可能应该将它添加到 &lt;bootFeatures/&gt;&lt;startupFeatures/&gt; 但是:

  1. 我不知道它的名字是什么,因为只是说 &lt;feature&gt;cdi&lt;/feature&gt; 不会改变任何事情。
  2. 我不确定是在&lt;bootFeatures/&gt; 还是在&lt;startupFeatures/&gt;,甚至在&lt;installedFeatures/&gt; 中应该添加这个。

非常感谢。

西摩

【问题讨论】:

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


    【解决方案1】:

    我在问我自己的问题:以下是修复上述异常需要安装的功能:pax-cdi、pax-cdi-weld、pax-cdi-web、pax-web-weld。 亲切的问候, 西摩

    【讨论】:

      猜你喜欢
      • 2015-08-09
      • 2017-06-26
      • 1970-01-01
      • 1970-01-01
      • 2017-03-16
      • 2016-09-01
      • 1970-01-01
      • 2019-09-15
      • 2014-05-05
      相关资源
      最近更新 更多