In Karaf 4, you can add feature, bundle, config in a condition.

Regards
JB

On 06/24/2016 06:05 PM, Nick Baker wrote:
Aren’t those examples simple conditionally installing bundles? He was trying to 
conditionally add a dependent feature.

Thanks,
Nick

On 6/24/16, 12:03 PM, "Jean-Baptiste Onofré" <[email protected]> wrote:

By the way, to use conditional, you have to use at least Karaf 3.x.

Regards
JB

On 06/24/2016 06:02 PM, Jean-Baptiste Onofré wrote:
Hi Nick,

it's implemented and used Karaf internally.

For instance:

      <feature name="webconsole" description="Base support of the Karaf
WebConsole" version="${project.version}" resolver="(obr)">
          <config name="org.apache.karaf.webconsole">
              realm=karaf
          </config>
          <feature>http</feature>
          <bundle
start-level="30">mvn:org.apache.felix/org.apache.felix.metatype/${felix.metatype.version}</bundle>

          <bundle
start-level="30">mvn:org.apache.karaf.webconsole/org.apache.karaf.webconsole.branding/${project.version}</bundle>

          <bundle
start-level="30">mvn:org.apache.karaf.webconsole/org.apache.karaf.webconsole.console/${project.version}</bundle>

          <conditional>
              <condition>eventadmin</condition>
              <bundle
start-level="30">mvn:org.apache.felix/org.apache.felix.webconsole.plugins.event/${felix.eventadmin.webconsole.plugin.version}</bundle>

          </conditional>
          <conditional>
              <condition>scr</condition>
              <bundle
start-level="30">mvn:org.apache.felix/org.apache.felix.webconsole.plugins.ds/${felix.scr.webconsole.plugin.version}</bundle>

          </conditional>
      </feature>

you can see that the webconsole ds and eventadmin plugins will be
installed only if/when the eventadmin or scr features are installed.

Regards
JB

On 06/24/2016 05:57 PM, Nick Baker wrote:
Hey All, quick question. One of my developers is trying to use a Feature
conditional to optionally depend on another feature.

<feature name=”a”>

<conditional>

<condition>foo</condition>

<feature>b</feature>

</conditional>

I’ve told him I don’t think it was actually implemented even though it
was mentioned in the original case:
https://issues.apache.org/jira/browse/KARAF-1718 Instead, I’ve
instructed him to move the conditional down a level into “b”.

Anyone know off the top of their heads if I’m right?

Thanks,

Nick



--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com


--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to