Hi folks,

Looking at the karaf-maven-plugin source code with a few debugging
session makes me wonder if features are actually processes recursively
for assembly construction. If a read the code correctly, building up the
assembly's system repository is actually done inside InstallKarsMojo.

For my little test project (
https://github.com/misl/Samples/tree/master/WicketKaraf ) I have the
following mojo internals:

featureSet=
[standard_split_for_name_and_version_3.0.0-SNAPSHOT
 jndi_split_for_name_and_version_1.0.0
 scr_split_for_name_and_version_3.0.0-SNAPSHOT
 management_split_for_name_and_version_3.0.0-SNAPSHOT
 wicketkaraf-simple_split_for_name_and_version_1.0.0-SNAPSHOT
 transaction_split_for_name_and_version_1.0.1
 package_split_for_name_and_version_3.0.0-SNAPSHOT
 aries-annotation_split_for_name_and_version_3.0.0-SNAPSHOT
 eventadmin_split_for_name_and_version_3.0.0-SNAPSHOT
 jasypt-encryption_split_for_name_and_version_3.0.0-SNAPSHOT
 wrapper_split_for_name_and_version_3.0.0-SNAPSHOT
 application-without-isolation_split_for_name_and_version_1.0.0
 webconsole_split_for_name_and_version_3.0.0-SNAPSHOT
 http-whiteboard_split_for_name_and_version_3.0.0-SNAPSHOT
 ssh_split_for_name_and_version_3.0.0-SNAPSHOT
 jpa_split_for_name_and_version_1.0.1
 config_split_for_name_and_version_3.0.0-SNAPSHOT
 scheduler_split_for_name_and_version_3.0.0-SNAPSHOT
 jetty_split_for_name_and_version_8.1.9.v20130131
 war_split_for_name_and_version_3.0.0-SNAPSHOT
 kar_split_for_name_and_version_3.0.0-SNAPSHOT
 obr_split_for_name_and_version_3.0.0-SNAPSHOT
 region_split_for_name_and_version_3.0.0-SNAPSHOT
 http_split_for_name_and_version_3.0.0-SNAPSHOT]

missingDependencies=
[pax-http_split_for_name_and_version_3.0.1
 pax-wicket_split_for_name_and_version_0.0.0
 pax-wicket-blueprint_split_for_name_and_version_0.0.0]
 
localRepoFeatures =
[standard_split_for_name_and_version_3.0.0-SNAPSHOT
 config_split_for_name_and_version_3.0.0-SNAPSHOT
 http_split_for_name_and_version_3.0.0-SNAPSHOT
 ssh_split_for_name_and_version_3.0.0-SNAPSHOT
 wicketkaraf-simple_split_for_name_and_version_1.0.0-SNAPSHOT]

Initially I wondered about the missing version numbers in
missingDependencies. After applying a version number to my feature
dependencies I got the following:

missingDependencies=
[pax-http_split_for_name_and_version_3.0.1
 pax-wicket_split_for_name_and_version_3.0.1
 pax-wicket-blueprint_split_for_name_and_version_3.0.1]

This change however had no effect and dependent bundles are still missing.

Looking more closely I noticed that the features in missingDependencies
are not present in the featureSet. The featureSet is used to lookup
feature dependencies to add the bundles of these features to the system
repository. Since the missingDependencies are not in the featureSet the
mojo is not able to missing dependency bundles to add to the system repo.

Also I could not find any code to actually recursively read dependent
feature files.

<features name="wicketkaraf" version="1.0.0-SNAPSHOT">
 
<repository>mvn:org.ops4j.pax.wicket/paxwicket/3.0.1/xml/features</repository>
 
<repository>mvn:org.ops4j.pax.wicket/features/3.0.1/xml/features</repository>
  ...

With this knowledge I decided to add additional feature dependencies to
my assembly pom:

    <dependency>
      <groupId>org.ops4j.pax.wicket</groupId>
      <artifactId>paxwicket</artifactId>
      <version>${pax.wicket.version}</version>
      <classifier>features</classifier>
      <type>xml</type>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.ops4j.pax.wicket</groupId>
      <artifactId>features</artifactId>
      <version>${pax.wicket.version}</version>
      <classifier>features</classifier>
      <type>xml</type>
      <scope>runtime</scope>
    </dependency>

These additional dependencies take care of adding additional features to
the featureSet. Thus allowing the mojo to copy the required bundles to
the assembly's system repo. Checking this out confirmed my expectation.
The missing bundles are now present in the assembly's system repo.

Is the maven-karaf-plugin meant to add bundles of dependent features
even if the features repository is not added to the assembly pom? If so
it is not working. If not I would expect a build error or at least a
warning that a dependent feature could not be found. Should I create
issues for this?

Have I analysed things correctly or have I missed something?

Hope someone can understand this brain dump ;-)

Regards,

Minto

 

Op 25-9-2013 16:12, Minto van der Sluis schreef:
> Hi Nick,
>
> Pax-Wicket feature files (there are 2) do not use dependency="true".
> Nevertheless I tried setting the ignoreDependencyFlag to true, but this
> has no effect.
>
> Also I tried using 3.0.0-SNAPSHOT instead of 3.0.0.RC1. Unfortunately
> the expected bundles are still missing.
>
> Any other options for me to try?
>
> Regards,
>
> Minto
>
>
> Op 24-9-2013 21:16, Nick Smith schreef:
>> If the Pax-Wicket feature file uses dependency="true" for the missing 
>> bundles you could be hitting issue : 
>>
>> https://issues.apache.org/jira/browse/KARAF-2357 
>>
>> for which a workaround / fix was added post 3.0.0.RC1 release. Have you 
>> tried with the latest 3.0.0-SNAPSHOT?
>>
>> Regards,
>>
>> Nick
>>
>> On 24.09.13, Jean-Baptiste Onofré  <[email protected]> wrote:
>>
>>> Hi Minto,
>>>
>>> thanks for the use case, I will take a look on that. I'm pretty sure that 
>>> we fixed something in the Maven plugin around transitive dependencies.
>>>
>>> I keep you posted.
>>>
>>> Regards
>>> JB
>>>
>>> On 09/24/2013 02:12 PM, Minto van der Sluis wrote:
>>>> Hi JB,
>>>>
>>>> One of my little example application has exactly the same behaviour. The
>>>> example app is available on github
>>>> https://github.com/misl/Samples/tree/master/WicketKaraf
>>>>
>>>> In this app there is a feature dependency on pax-wicket. In the final
>>>> assembly archive the pax-wicket libraries are missing. Still the
>>>> assembly runs just fine (with maven present).
>>>>
>>>> Regards,
>>>>
>>>> Minto
>>>>
>>>> Op 24-9-2013 13:22, Minto van der Sluis schreef:
>>>>> Hi JB,
>>>>>
>>>>> Like this?
>>>>>
>>>>>    <feature name="clerezza-jena-tdb" version="0.7.1.36"
>>>>> description="Clarezza Jena TDB components" resolver="(obr)">
>>>>>      <feature version="0.7.1.36">clerezza-jena</feature>
>>>>>      <bundle dependency="true"
>>>>> start-level="36">mvn:org.apache.clerezza.ext/org.apache.jena.jena-tdb/1.0.0_1-SNAPSHOT</bundle>
>>>>>      <bundle dependency="true"
>>>>> start-level="36">mvn:org.apache.clerezza/rdf.jena.tdb.storage/0.7-SNAPSHOT</bundle>
>>>>>    </feature>
>>>>>
>>>>> Doesn't seem to make any difference.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Minto
>>>>>
>>>>>
>>>>> Op 24-9-2013 11:09, Jean-Baptiste Onofré schreef:
>>>>>> Hi Minto,
>>>>>>
>>>>>> can you try to use dependency="true" on the bundle ?
>>>>>>
>>>>>> Regards
>>>>>> JB
>>>>>>
>>>>>> On 09/24/2013 10:58 AM, Minto van der Sluis wrote:
>>>>>>> Hi Folks,
>>>>>>>
>>>>>>> When using Karaf 3.0.0. RC1 I end up with an assembly that does not
>>>>>>> contain all dependencies. All features.xml files are present but not all
>>>>>>> bundles mentioned in these features are present.
>>>>>>>
>>>>>>> It almost seems as if bundles from dependent features are missing in the
>>>>>>> assembly. Like in the following brief example where "my-features" is
>>>>>>> included in the assembly as bootFeature:
>>>>>>>
>>>>>>>     <feature name="other-feature" ...>
>>>>>>>       <bundle>mvn:...</bundle>  <-- not present in assembly
>>>>>>>     </feature>
>>>>>>>
>>>>>>>     <feature name="my-features" .... >
>>>>>>>       <feature>other-feature</feature>
>>>>>>>       <bundle>mvn:.... </bundle>  <-- present in assembly
>>>>>>>     </feature>
>>>>>>>
>>>>>>> On my development system I did not immediately noticed this because the
>>>>>>> bundles could be found by there maven id. However when I installed the
>>>>>>> assembly on a system without maven these bundles could not be started.
>>>>>>>
>>>>>>> I am probably missing an important detail. What do I need to do to get
>>>>>>> these missing bundles in my assembly as well?
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Minto
>>>>>>>
>>>>>>>
>>>>>>> Assembly build log adding all the feature files:
>>>>>>>
>>>>>>> <snip>
>>>>>>> [INFO] --- karaf-maven-plugin:3.0.0.RC1:install-kars
>>>>>>> (default-install-kars) @ reva-assembly ---
>>>>>>> [INFO] Installing feature
>>>>>>> file:/C:/Dev/src/Werk/Ictu/Digimelding2.0/github/reva/src/reva-assembly/target/assembly/system/org/apache/karaf/features/framework/3.0.0.RC1/framework-3.0.0.RC1-features.xml
>>>>>>>
>>>>>>> to system and startup.properties
>>>>>>> [INFO] Adding feature repository to system:
>>>>>>> mvn:org.apache.karaf.features/standard/3.0.0.RC1/xml/features
>>>>>>> [INFO] Adding feature repository to system:
>>>>>>> mvn:org.apache.karaf.features/enterprise/3.0.0.RC1/xml/features
>>>>>>> [INFO] Adding feature repository to system:
>>>>>>> mvn:nl.overheid.stelsel.gba.reva/reva-features/0.1.0-SNAPSHOT/xml/features
>>>>>>>
>>>>>>> [INFO] Adding feature repository to system:
>>>>>>> mvn:org.apache.shiro/shiro-features/1.2.2/xml/features
>>>>>>> [INFO] Adding feature repository to system:
>>>>>>> mvn:org.ops4j.pax.wicket/paxwicket/3.0.1/xml/features
>>>>>>> [INFO] Adding feature repository to system:
>>>>>>> mvn:org.ops4j.pax.wicket/features/3.0.1/xml/features
>>>>>>> [INFO] Adding feature repository to system:
>>>>>>> mvn:nl.overheid.stelsel.digimelding.astore/clerezza-features/0.7.1.36/xml/features
>>>>>>>
>>>>>>> [INFO] Adding feature repository to system:
>>>>>>> mvn:nl.overheid.stelsel.digimelding.astore/astore-features/0.7.1.36/xml/features
>>>>>>>
>>>>>>> <snap>
>>>>>>>
>>> -- 
>>> Jean-Baptiste Onofré
>>> [email protected]
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>


-- 
ir. ing. Minto van der Sluis
Software innovator / renovator
Xup BV

Mobiel: +31 (0) 626 014541

Reply via email to