Brian Topping created KARAF-1390:
------------------------------------

             Summary: Embedded features should have POM dependencies on the 
projects they represent
                 Key: KARAF-1390
                 URL: https://issues.apache.org/jira/browse/KARAF-1390
             Project: Karaf
          Issue Type: Improvement
          Components: karaf-feature
    Affects Versions: 3.0.0
            Reporter: Brian Topping


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:

# The features are created by hand using features.xml templates in 
src/main/feature
# 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:

# Create a project that depends on spring-core and attaches a features.xml to a 
bundle with the plugin defaults.
# A {{<features>}} file should be generated with one {{<feature>}} element.  
Save the output.
# 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"/>}}).
# Add this dependency as the first dependency in the project POM:
{code}
        <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>
{code}

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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to