Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-5199

Karaf installs both version of the feature (old and new) in case if referencing feature contains wrapped bundle with package import

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.9
    • Fix Version/s: 4.2.0.M1
    • Component/s: karaf
    • Labels:
      None

      Description

      Accordingly documentation, if feature is available in multiple versions, the newest version have to be installed:

      The <feature/> element contains the name of a feature. A specific feature version can be defined using the version attribute to the <feature/> element (<feature version="1.0.0">feature1</feature>). If the version attribute is not specified, Apache Karaf will install the latest version available.
      

      Unfortunatelly it is not always the case.
      Use case:
      1) feature basit-thirdparty-jollyday references wrapped jar (jollyday library); this feature is available in two different versions (1.0.0-SNAPSHOT and 2.0.0-SNAPSHOT) and contains different versions of jolly (0.4.6 and 0.5.2 correspondingly);
      2) bundle test-jolly uses packages from wrapped jar (jollyday library);
      3) feature test-feature references basit-thirdparty-jollyday and test-jolly bundle.

      Karaf repositories list contains both versions of basit-thirdparty-jollyday and test-feature:

      karaf@root()> feature:list | grep basit
      basit-thirdparty-jollyday     | 2.0.0.SNAPSHOT   |          | Uninstalled | ccp
                           |
      basit-thirdparty-jollyday     | 1.0.0.SNAPSHOT   |          | Uninstalled | ccp
                           |
      basit-test-feature            | 1.0.0.SNAPSHOT   |          | Uninstalled | ccp
                           |
      karaf@root()>

      If I try to install basit-thirdparty-jollyday feature - it works as expected: only 2.0.0.SNAPSHOT will be installed:

      karaf@root()> feature:install -t -v basit-thirdparty-jollyday
      Adding features: basit-thirdparty-jollyday/[2.0.0.SNAPSHOT,2.0.0.SNAPSHOT]
      Changes to perform:
        Region: root
          Bundles to install:
            wrap:mvn:de.jollyday/jollyday/0.5.2
      

      But if I try to install basit-test-feature, Karaf installs BOTH versions of basit-thirdparty-jollyday:

      karaf@root()> feature:install -t -v basit-test-feature
      Adding features: basit-test-feature/[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]
      Changes to perform:
        Region: root
          Bundles to install:
            mvn:de.conrad.ccp.basit/test-jolly/1.0.0-SNAPSHOT
            wrap:mvn:de.jollyday/jollyday/0.4.6
            wrap:mvn:de.jollyday/jollyday/0.5.2
      karaf@root()>
      

      If I exclude bundle test-jolly from basit-test-feature, installation works as expected again (only new jolly feature will be installed)

      The test projects to reproduce the problem and org.apache.karaf.features.cfg are attached

        Attachments

        1. org.apache.karaf.features.cfg
          3 kB
          Andrei Shakirin
        2. test-feature-project.zip
          16 kB
          Andrei Shakirin

          Activity

            People

            • Assignee:
              gnt Guillaume Nodet
              Reporter:
              ashakirin Andrei Shakirin
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: