features.xml + dependency="true"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

features.xml + dependency="true"

Sergey Zhemzhitsky

Hi there,

 

It the last versions of karaf, feature’s bundles can be marked with dependency=”true” attribute.

It seems that such a bundles will not be resolved when installing a new feature.

 

For example I have third party feature cxf

 

<feature name=”cxf”>

        …

        <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jdom/1.1_3</bundle>

        <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_2</bundle>

        <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream/1.3_3</bundle>

        …

</feature>

 

And in my feature I would like to add a reference to this cxf feature

 

<feature name=”my-feature”>

    <feature>cxf</feature>

</feature>

 

When I’m trying to install my-feature I would like the bundles marked as dependencies in cxf feature to be resolved because I’m getting exceptions like

“Requested factory com.ctc.wstx.stax.WstxInputFactory cannot be located”, etc.

 

I don’t like my feature to depend from “dependencies” of third party features explicitly, because it does not use them.

 

Is it possible to force third party features to resolve their dependencies?

 

Best Regards,

Sergey Zhemzhitsky

_______________________________________________________

 

The information contained in this message may be privileged and conf idential and protected from disclosure. If you are not the original intended recipient, you are hereby notified that any review, retransmission, dissemination, or other use of, or taking of any action in reliance upon, this information is prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message and delete it from your computer. Thank you for your cooperation. Troika Dialog, Russia.

If you need assistance please contact our Contact Center (+7495) 258 0500 or go to www.troika.ru/eng/Contacts/system.wbp

 

Reply | Threaded
Open this post in threaded view
|

Re: features.xml + dependency="true"

iocanel
Hi Sergey,

The role of the dependency attribute is to mark that a bundle is a dependency. If a dependency is already satisfied (an existing bundle already exports the same packages/version) then it doesn't get installed. This behavior happens if the declared feature resolver is installed (e.g. obr is installed).

In your case "my-feature" depends from the cxf feature. The cxf feature requires the presence of jdom, dom xstream etc. It specifies the servicemix bundles that satisfy those dependencies. If the specified resolver is present, it will check to see if those dependencies are already fulfilled and only in those case that are not, will those bundles be installed.


I am not sure if the exception that you mentioned is somehow related to the dependency attribute. Maybe a complete stack trace could shed some more light into it.

--
Ioannis Canellos

Apache Karaf Committer & PMC
Apache ServiceMix  Committer
Apache Gora Committer





Ioannis Canellos
http://iocanel.blogspot.com