Can't use pax-web-jetty-extras with Karaf 4.4.4
AndreVirtimo opened this issue · 6 comments
I have added pax-web-jetty-extras as bootFeature in my custom Karaf distribution. This was needed to have the RewriteHander available (see #1712).
With Karaf 4.4.3 we have no problems.
Here is a demo pom to reproduce this issue with mvn clean install
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>karaf-assembly-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>karaf-assembly</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.reportEncoding>UTF-8</project.build.reportEncoding>
<target.name>${project.artifactId}</target.name>
<karaf.version>4.4.4</karaf.version><!-- on update, please check the Karaf sources for installed/startup/boot feature changes (mentioned below) -->
<cxf.version>3.5.7</cxf.version><!-- Hier schauen, ob es eine neue Version gibt: https://cxf.apache.org -->
<karaf-maven-plugin.version>${karaf.version}</karaf-maven-plugin.version>
<maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
<maven-install-plugin.version>2.5.2</maven-install-plugin.version>
<maven-release-plugin.version>3.0.0-M4</maven-release-plugin.version>
<dependency-check-maven.version>8.3.1</dependency-check-maven.version>
<download-maven-plugin.version>1.6.8</download-maven-plugin.version>
<cyclonedx-maven-plugin.version>2.7.8</cyclonedx-maven-plugin.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>framework</artifactId>
<version>${karaf.version}</version>
<classifier>features</classifier>
<type>xml</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>standard</artifactId>
<version>${karaf.version}</version>
<classifier>features</classifier>
<type>xml</type>
</dependency>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>enterprise</artifactId>
<classifier>features</classifier>
<type>xml</type>
<version>${karaf.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf.karaf</groupId>
<artifactId>apache-cxf</artifactId>
<version>${cxf.version}</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-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<targetFile>${target.name}</targetFile>
<archiveZip>true</archiveZip>
<archiveTarGz>true</archiveTarGz>
<installedFeatures>
<feature>wrapper</feature>
<feature>aries-blueprint</feature>
<feature>shell-compat</feature>
</installedFeatures>
<startupFeatures>
<feature>eventadmin</feature>
</startupFeatures>
<bootFeatures>
<feature>wrap</feature>
<feature>classpath</feature>
<feature>shell</feature>
<feature>feature</feature>
<feature>jaas</feature>
<feature>ssh</feature>
<feature>management</feature>
<feature>bundle</feature>
<feature>config</feature>
<feature>deployer</feature>
<feature>diagnostic</feature>
<feature>feature</feature>
<feature>instance</feature>
<feature>kar</feature>
<feature>log</feature>
<feature>package</feature>
<feature>service</feature>
<feature>system</feature>
<feature>pax-web-jetty-websockets</feature>
<feature>pax-web-jetty-extras</feature><!-- otherwise RewriteHandler cannot be found; https://github.com/ops4j/org.ops4j.pax.web/issues/1712 -->
<feature>pax-web-karaf</feature>
</bootFeatures>
</configuration>
</plugin>
</plugins>
</build>
</project>
But ... what's the issue? :)
Ah:
[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.4.4:assembly (default-assembly) on project karaf-assembly-test: Unable to build assembly: Could not find matching feature for spifly/0.0.0 -> [Help 1]
After adding:
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>specs</artifactId>
<version>${karaf.version}</version>
<classifier>features</classifier>
<type>xml</type>
</dependency>
the project builds fine.
And the reason is #1842 where I added dependency on spifly
feature for pax-web-jetty-extras
feature.
Mind that Pax Web features don't include Karaf's feature repositories (it's the other way round), so you need to provide this.
Sorry for inconvenience...
Sorry. I have forgotten to paste the error string. Thank you for the quick answer. The build is now fine.
Can you explain why this dependency is now needed? Was this a transitive dependency in Karaf 4.4.3 or in pax-web?
spifly
feature in Pax Web started to be required because of jetty-openid requirement:
Require-Capability: osgi.extender;filter:="(osgi.extender=osgi.servicelo
ader.registrar)",osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
See https://github.com/eclipse/jetty.project/blame/jetty-9.4.52.v20230823/jetty-openid/pom.xml#L31 - not all Jetty artifacts have this requirement...