Seymour Glass
Seymour Glass

Reputation: 161

karaf-maven-plugin: unable to resolve missing requirement osgi.cdi

I have seen a couple of similar issues reported here but they were either unanswered or with non relevant solutions for my case. I'm trying to build a maven project using the karaf-maven-plugin. Here is the POM's relevant fragment:

  <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>

Trying to build, the following exception is raised:

[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]

So, what obviously happens is that the OSGI extender for CDI (osgi.cdi) is not installed. I probably should add it to the <bootFeatures/> or to the <startupFeatures/> but:

  1. I don't know what's its name 'cause simply saying <feature>cdi</feature> doesn't change anything.
  2. I'm not sure whether it is in <bootFeatures/> or in <startupFeatures/>, or even in <installedFeatures/> that this should be added.

Many thanks in advance.

Seymour

Upvotes: 0

Views: 454

Answers (1)

Seymour Glass
Seymour Glass

Reputation: 161

I'm asking my own question: here are the features that need to be installed in order to fix the mentioned exception: pax-cdi, pax-cdi-weld, pax-cdi-web, pax-web-weld. Kind regards, Seymour

Upvotes: 0

Related Questions