You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jan-Peter Nilsson (JIRA)" <ji...@apache.org> on 2018/02/22 22:12:01 UTC
[jira] [Created] (KARAF-5637)
karaf-maven-plugin:features-add-to-repository crash on features with
circular dependencies
Jan-Peter Nilsson created KARAF-5637:
----------------------------------------
Summary: karaf-maven-plugin:features-add-to-repository crash on features with circular dependencies
Key: KARAF-5637
URL: https://issues.apache.org/jira/browse/KARAF-5637
Project: Karaf
Issue Type: Bug
Components: karaf-tooling
Affects Versions: 4.1.5, 4.1.4, 4.1.6
Reporter: Jan-Peter Nilsson
The features-add-to-repository goal in the karaf-maven-plugin will go into an infinite recursion in addFeaturesDependencies (until it runs out of stack) when given a feature descriptor that contains features with circular dependencies.
A wild example of such a feature descriptor is mvn:org.ops4j.pax.cdi/pax-cdi-features/1.0.0/xml/features.
A reduced example
{code:xml}
<features name="test features" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<feature name="FeatureA" description="Test Feature A" version="1.0.0">
<feature version="1.0.0">FeatureB</feature>
</feature>
<feature name="FeatureB" description="Test Feature B" version="1.0.0">
<feature version="1.0.0">FeatureA</feature>
</feature>
</features>
{code}
{code:xml}
<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>test</groupId>
<artifactId>test-features-add-to-repository-circular-dependencies</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>@pom.version@</version>
<executions>
<execution>
<id>build-features-repo</id>
<phase>generate-resources</phase>
<goals>
<goal>features-add-to-repository</goal>
</goals>
<configuration>
<descriptors>
<descriptor>features.xml</descriptor>
</descriptors>
<repository>${project.build.directory}/features</repository>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
{code}
This will crash the plugin
{noformat}
Exception in thread "main" java.lang.StackOverflowError
at org.apache.karaf.tooling.features.AbstractFeatureMojo.getMatchingFeature(AbstractFeatureMojo.java:198)
at org.apache.karaf.tooling.features.AbstractFeatureMojo.addFeaturesDependencies(AbstractFeatureMojo.java:188)
at org.apache.karaf.tooling.features.AbstractFeatureMojo.addFeaturesDependencies(AbstractFeatureMojo.java:191)
at org.apache.karaf.tooling.features.AbstractFeatureMojo.addFeaturesDependencies(AbstractFeatureMojo.java:191)
....{noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)