You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Grzegorz Grzybek (JIRA)" <ji...@apache.org> on 2017/12/06 13:04:01 UTC

[jira] [Commented] (KARAF-4684) karaf-maven-plugin assembly goal fails to find nested features with explicit version containing qualifier

    [ https://issues.apache.org/jira/browse/KARAF-4684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16280149#comment-16280149 ] 

Grzegorz Grzybek commented on KARAF-4684:
-----------------------------------------

I checked your scenario with upcoming Karaf 4.2.

First I did:
{noformat}
13:56 $ git diff
diff --git a/assembly/pom.xml b/assembly/pom.xml
index e3b48b3..4fa4add 100644
--- a/assembly/pom.xml
+++ b/assembly/pom.xml
@@ -12,7 +12,7 @@
     <description>Simple custom assembly which includes a simple project feature set on top of minimal distribution</description>
 
     <properties>
-        <karaf.version>4.0.6</karaf.version>
+        <karaf.version>4.2.0-SNAPSHOT</karaf.version>
         <sample.version>1.0-SNAPSHOT</sample.version>
     </properties>
 
@@ -94,6 +94,12 @@
             <classifier>features</classifier>
             <type>xml</type>
         </dependency>
+        <dependency>
+            <groupId>org.deklanowski.karaf</groupId>
+            <artifactId>impl</artifactId>
+            <version>${sample.version}</version>
+            <scope>runtime</scope>
+        </dependency>
         <dependency>
             <groupId>org.deklanowski.karaf</groupId>
             <artifactId>features</artifactId>
{noformat}

To change the order of artifacts - so assembly artifact is built *after* api and impl.

Everything was resolved having your:
{code:xml}
<feature name="impl" version="${project.version}">
    <feature version="${project.version}">api</feature>
    <bundle>mvn:org.deklanowski.karaf/impl/${project.version}</bundle>
</feature>
{code}

Proper version was included in {{sample-karaf-assembly/assembly/target/assembly/system/org/deklanowski/karaf/features/1.0-SNAPSHOT/features-1.0-SNAPSHOT-features.xml}}:
{code:xml}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features name="sample-features-1.0-SNAPSHOT" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">

    <feature name="api" version="1.0-SNAPSHOT">
        <bundle>mvn:org.deklanowski.karaf/api/1.0-SNAPSHOT</bundle>
    </feature>

    <feature name="impl" version="1.0-SNAPSHOT">
        <feature version="1.0-SNAPSHOT">api</feature>
        <bundle>mvn:org.deklanowski.karaf/impl/1.0-SNAPSHOT</bundle>
    </feature>

</features>
{code}

And I could even run your distro:
{noformat}
karaf@root()> la -l
START LEVEL 100 , List Threshold: 0
 ID │ State    │ Lvl │ Version               │ Location
────┼──────────┼─────┼───────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  0 │ Active   │   0 │ 5.6.10                │ System Bundle
  1 │ Resolved │   1 │ 2.6.0                 │ mvn:org.apache.felix/org.apache.felix.framework.security/2.6.0
  2 │ Resolved │   1 │ 4.2.0.SNAPSHOT        │ mvn:org.apache.karaf.features/org.apache.karaf.features.extension/4.2.0-SNAPSHOT
...
137 │ Active   │  80 │ 1.0.0.SNAPSHOT        │ mvn:org.deklanowski.karaf/api/1.0-SNAPSHOT
138 │ Active   │  80 │ 1.0.0.SNAPSHOT        │ mvn:org.deklanowski.karaf/impl/1.0-SNAPSHOT
139 │ Active   │  30 │ 8.1.14.v20131031      │ mvn:org.eclipse.jetty.aggregate/jetty-all-server/8.1.14.v20131031
{noformat}


> karaf-maven-plugin assembly goal fails to find nested features with explicit version containing qualifier
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: KARAF-4684
>                 URL: https://issues.apache.org/jira/browse/KARAF-4684
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-profile
>    Affects Versions: 4.0.5, 4.0.6
>            Reporter: Declan Cox
>            Assignee: Grzegorz Grzybek
>            Priority: Minor
>             Fix For: 4.2.0
>
>
> In karaf 4.0.5 and 4.0.6 (at least) there is an issue with nested features which explicitly declare a version when that version has a qualifier e.g., such as development snapshot version like 1.0-SNAPSHOT or a release qualifier like for example 1.0.0-RELEASE.
>  
> For example, take our features descriptor for a simple project:
> {noformat}
>     <feature name="api" version="${project.version}">
>         <bundle>mvn:org.deklanowski.karaf/api/${project.version}</bundle>
>     </feature>
>     <feature name="impl" version="${project.version}">
>         <feature version="${project.version}">api</feature> 
>         <!--feature>api</feature-->
>         <bundle>mvn:org.deklanowski.karaf/impl/${project.version}</bundle>
>     </feature>
> {noformat}
> If we explicitly include the version of the nested api feature inside the impl feature then 
> you will get the following output when building the assembly:
> {noformat}
> [INFO] Reactor Summary:
> [INFO] 
> [INFO] sample feature ..................................... SUCCESS [  0.116 s]
> [INFO] sample karaf feature repository .................... SUCCESS [  0.763 s]
> [INFO] sample karaf assembly configuration ................ FAILURE [  2.727 s]
> [INFO] sample feature api ................................. SKIPPED
> [INFO] sample feature impl ................................ SKIPPED
> [INFO] sample assembly reactor ............................ SKIPPED
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 5.178 s
> [INFO] Finished at: 2016-08-30T10:52:02+01:00
> [INFO] Final Memory: 23M/399M
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.6:assembly (default-assembly) on project assembly: Unable to build assembly: Could not find matching feature for api/1.0-SNAPSHOT -> {noformat}
> Excluding the version number solves the issue. As stated this is not limited to snapshot qualifiers, any qualifier of the form {noformat}'-<qualifier>'{noformat} seems to do it. 
> Debugging the assembly yields the problem emanating from the recursive addFeatures method in the karaf assembly building subsystem [Builder.java|https://github.com/apache/karaf/blob/karaf-4.0.6/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java]. 
> Please see my sample project and debug screenshots in [sample-karaf-assembly|https://github.com/deklanowski/sample-karaf-assembly]



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)