-
Notifications
You must be signed in to change notification settings - Fork 664
Description
I have a project that is generating karaf features, some of the dependencies that we use have their own dependencies that are not compatible with OSGI, so the generated feature file utilizes the wrap protocol to expose those dependencies within OSGI.
When trying to generate the karaf assemble with karaf-maven-plugin, there are errors with regards to missing requirements that I have found no way around.
[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.4.5:assembly (default-assembly) on project test-karaf-assembly: Unable to build assembly: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=wrap; type=karaf.feature; version=0; filter:="(&(osgi.identity=wrap)(type=karaf.feature)(version>=0.0.0))" -> [Help 1]
The feature being generated is using CXF as an example with a pom as follows
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>test-karaf-feature</artifactId>
<version>1.0.0</version>
<packaging>feature</packaging>
<properties>
<karaf.version>4.4.5</karaf.version>
</properties>
<dependencies>
<!-- Example dependencies to be converted to bundles -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.3.9</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>${karaf.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<!-- Version 3.X of the install plugin doesn't seem compatible with the feature packaging of the karaf-maven-plugin resulting in error unless we specify the allowIncompleteProjects=true-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<allowIncompleteProjects>true</allowIncompleteProjects>
</configuration>
</plugin>
<plugin>
<!-- Version 3.X of the deploy plugin doesn't seem compatible with the feature packaging of the karaf-maven-plugin resulting in error unless we specify the allowIncompleteProjects=true-->
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<allowIncompleteProjects>true</allowIncompleteProjects>
</configuration>
</plugin>
</plugins>
</build>
</project>
The assembly is being generated with the following pom
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.raytheon.eclipse.portal</groupId>
<artifactId>portal-parent</artifactId>
<version>${revision}${changelist}</version>
</parent>
<artifactId>test-karaf-assembly</artifactId>
<packaging>karaf-assembly</packaging>
<properties>
<karaf.version>4.4.5</karaf.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>framework</artifactId>
<version>${karaf.version}</version>
<type>kar</type>
</dependency>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>standard</artifactId>
<version>${karaf.version}</version>
<classifier>features</classifier>
<type>xml</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>test-karaf-feature</artifactId>
<version>1.0.0</version>
<classifier>features</classifier>
<type>xml</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>${karaf.version}</version>
<extensions>true</extensions>
<configuration>
<finalName>${project.artifactId}</finalName>
<installedBundles>
<installedBundle>${additional.bundle}</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>
</bootFeatures>
<archiveZip>false</archiveZip>
</configuration>
</plugin>
</plugins>
</build>
</project>Workaround Attempts
Tried to resolve by creating a /src/main/feature/feature.xml template that included the karaf feature repository and enabling the enableGeneration option.
src/main/feature/feature.xml
<features name="${project.artificatId}" xmlns="http://karaf.apache.org/xmlns/features/v1.6.0">
<repository>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</repository>
<feature name="${project.artifactId}" version="${project.version}">
<feature>wrap</feature>
<!-- plugin will add bundles here -->
</feature>
</features>Which resulted in this error during the assembly
[ERROR] Failed to execute goal [32morg.apache.karaf.tooling:karaf-maven-plugin:4.4.5:assembly (default-assembly) on project test-karaf-assembly Unable to build assembly: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=wrap; type=karaf.feature; version=0; filter:="(&(osgi.identity=wrap)(type=karaf.feature)(version>=0.0.0))" [caused by: Unable to resolve wrap/2.6.14: missing requirement [wrap/2.6.14] osgi.identity; osgi.identity=pax-url-wrap; type=karaf.feature; version="[2.6.14,2.6.14]" [caused by: Unable to resolve pax-url-wrap/2.6.14: missing requirement [pax-url-wrap/2.6.14] osgi.identity; osgi.identity=org.ops4j.pax.url.wrap; type=osgi.bundle; version="[2.6.14,2.6.14]"; resolution:=mandatory [caused by: Unable to resolve org.ops4j.pax.url.wrap/2.6.14: missing requirement [org.ops4j.pax.url.wrap/2.6.14] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.osgi.service.log)(version>=1.3.0)(!(version>=2.0.0)))"]]] -> [Help 1]
I suppose this might have worked if the wrap feature had declared the pax-logging-api bundle but it did not.