Hi Ed,
They should show up like:

344 | Active |  50 | 1.3.5                              | jettison
345 | Active |  50 | 2.4.1                              | Jackson-core
346 | Active |  50 | 2.4.1                              | jackson-databind
347 | Active |  50 | 2.4.1                              | Jackson-annotations

I’ve found the “dependency” is sometimes flaky and use the install=auto flag 
when I want something to be installed

Here is my feature for Jackson:
<feature name="jackson" description="Jackson requirements for Karaf" 
install="auto"  version="2.5.4" resolver="(obr)">
        <bundle>mvn:com.fasterxml.jackson.core/jackson-core/2.5.4</bundle>
        
<bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/2.5.4</bundle>
        <bundle>mvn:com.fasterxml.jackson.core/jackson-databind/2.5.4</bundle>
        
<bundle>mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.5.4</bundle>
             
<bundle>mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/2.5.4</bundle>
             <bundle>mvn:org.codehaus.jackson/jackson-jaxrs/1.9.13</bundle>
             <bundle>mvn:org.codehaus.jackson/jackson-core-asl/1.9.13</bundle>
             <bundle>mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.13</bundle>
</feature>

I had to include the old codehaus jars for some CXF issues, hope this helps

Kind regards,
Jason

From: Ed Hillmann [mailto:[email protected]]
Sent: Thursday, July 23, 2015 7:07 PM
To: [email protected]
Subject: Understanding dependency in features.xml...

Hi.  I am attempting to define bundles as dependencies, but am getting some 
unexpected behaviour.  My presumption is I don't understand how it's meant to 
be used.  The doco around this is short and sweet: "A bundle can be flagged as 
being a dependency, using the dependency attribute set to true on the <bundle/> 
element."

My interpretation is this means "If the bundle is not there already, install 
it, I depend on it.  If not, just use it".  Perhaps I have interpreted it wrong.

I have a feature xml file that contains these definitions:

    <feature name="jackson" version="2.5.4" description="Jackson libraries">
        <bundle 
dependency="true">mvn:com.fasterxml.jackson.core/jackson-core/2.5.4</bundle>
        <bundle 
dependency="true">mvn:com.fasterxml.jackson.core/jackson-annotations/2.5.4</bundle>
        <bundle 
dependency="true">mvn:com.fasterxml.jackson.core/jackson-databind/2.5.4</bundle>
        <bundle 
dependency="true">mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/2.5.4</bundle>
    </feature>
    <feature name="jackson-jaxrs" version="2.5.4" description="Jackson JAX-RS 
libraries">
        <bundle 
dependency="true">mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/2.5.4</bundle>
        <bundle 
dependency="true">mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.5.4</bundle>
    </feature>


In the same file, I have a third feature that references these jackson features:

    <feature name="my-core-bundles" version="1.0.4-SNAPSHOT">
        <details>Features or bundles needed to support my code</details>
        <feature version="1.0.2.RELEASE">gemini-blueprint</feature>
        <feature version="4.0.0">war</feature>
        <feature version="4.3.6.Final">hibernate</feature>
        <feature version="2.5.4">jackson</feature>
        <feature version="2.5.4">jackson-jaxrs</feature>
        <feature version="3.1.0">cxf</feature>
        <feature version="4.1.6.RELEASE_1">spring</feature>
        <feature version="4.1.6.RELEASE_1">spring-jdbc</feature>
        <feature version="4.1.6.RELEASE_1">spring-orm</feature>
        <feature version="4.1.6.RELEASE_1">spring-tx</feature>
        <feature version="1.2.1.RELEASE_1">spring-data-cassandra</feature>
        <bundle 
dependency="true">mvn:org.apache.commons/commons-math3/3.5</bundle>
        <bundle dependency="true">mvn:com.hazelcast/hazelcast/3.5</bundle>
        <bundle dependency="true">mvn:io.reactivex/rxjava/1.0.12</bundle>
    </feature>

I can add my feature repository, and I can install my feature.  And it works, 
apparently without an error.  If I list my installed features, it says the 
Jackson features are started...

minestar-core-bundles    | 1.0.4.SNAPSHOT   | x        | Started | 
my-core-features-1.0.4-SNAPSHOT | myCore Bundles
jackson                  | 2.5.4            |          | Started | 
minestar-core-features-1.0.4-SNAPSHOT | Jackson libraries
jackson-jaxrs            | 2.5.4            |          | Started | 
minestar-core-features-1.0.4-SNAPSHOT | Jackson JAX-RS libraries

However, the jackson bundles are not visible when I list the bundles.  They're 
not even installed.  Anything I use which depends on Jackson won't resolve 
because it can't find anything.

If I define my Jackson feature without the "dependency" attribute, it works 
more like I expected.

Is my understanding of what the dependency attribute for a bundle in the 
features.xml incorrect?  If not, am I doing something else incorrectly?

Thanks for any help,
Ed

Reply via email to