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

Embedded features should have POM dependencies on the projects they represent

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0
    • 3.0.0
    • karaf
    • None

    Description

      The logic in karaf-maven-plugin:features-generate-descriptor looks at dependencies of the current project and will add project dependencies as either <bundle> or <feature> elements to a <feature> whose name matches the name of the project (or a new one if none exists). There are two problems when dealing with features in group o.a.k.assemblies:

      1. The features are created by hand using features.xml templates in src/main/feature
      2. The POMs for these features do not have dependencies on the bundles that they reference

      This limits functionality in features-generate-descriptor that would otherwise avoid adding bundles that are already a a part of a feature that the project depends on.

      For instance:

      1. Create a project that depends on spring-core and attaches a features.xml to a bundle with the plugin defaults.
      2. A <features> file should be generated with one <feature> element. Save the output.
      3. Now, copy that output to src/main/feature and remove the bundles that were generated for it. Add a reference to a standard Karaf feature (i.e. <feature name="spring"/>).
      4. Add this dependency as the first dependency in the project POM:
                <dependency>
                    <groupId>org.apache.karaf.assemblies.features</groupId>
                    <artifactId>standard</artifactId>
                    <version>2.2.6</version>  <!-- use whatever version here -->
                    <classifier>features</classifier>
                    <type>xml</type>
                    <scope>provided</scope>
                </dependency>
        

      At this point, when we do a build, the bundle references spring-core as a bundle, even though we added a <feature name="spring"/> above.

      The problem is that o.a.k.assemblies.features:standard does not have any dependencies, and because the features files themselves have insufficient data to create an artifact coordinate, it's difficult for the plugin to authoritatively know which version should be included in the generation.

      The primary piece of this solution then is to have the top-level dependencies referenced in the POM for the features. This is by default in projects that actually create a bundle, but it needs to be done for features-only projects. The next is a small patch for the plugin. I'm in the process of putting these together.

      Attachments

        1. k1390.patch
          69 kB
          Brian Topping

        Activity

          People

            jbonofre Jean-Baptiste Onofré
            topping Brian Topping
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: