karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Täschner <m.taesch...@googlemail.com>
Subject Re: Duplicate feature repository entry using archive-kar to build deployable applications
Date Fri, 13 Jan 2012 10:14:31 GMT
Hi David,

yes your assumptions are correct, project A (kar) has B as parent. Right
now I removed that parent relation and A remains as module of B but without
inheriting any dependencies.

I will have to consider your recommendation, not to declare dependencies in
parent projects as this is currently the approach throughout our Maven
projects. I understand though that this may lead to issues in regard to
OSGi and package imports using bnd plugin, etc.

Thanks and Regards,
Michael

2012/1/12 David Jencks <david_jencks@yahoo.com>

> Are you saying that you have projects
>
> A (your kar project)
> with parent
> B (this has dependencies defined, not dependencyManagement)
>
> and the dependencies from B are included in the kar?
>
> This is normal proper maven behavior.  The solution is to not define
> dependencies in B.  In my experience defining any dependencies in parent
> poms, no matter how tempting and convenient it looks, always causes severe
> problems as the project matures.
>
> thanks
> david jencks
>
> On Jan 12, 2012, at 5:12 AM, Michael Täschner wrote:
>
> Hi again,
>
> I found more details for the karaf-maven-plugin in the doc and changed the
> packaging to "kar". The feature.xml is now read from the src/main/feature
> folder and contained only once in the output kar. Unfortunately now a huge
> number of bundles are included which are inherited from parent projects
> where I only wanted the bundles defined in the input feature.xml. How can I
> disable the dependencies from being included in the feature.xml ? I tried
> with "includeTransitiveDependencies" = false but that does not help for
> ignoring inherited dependencies.
>
> Thanks and Regards,
> Michael
>
> Am 12. Januar 2012 11:44 schrieb Michael Täschner <
> m.taeschner@googlemail.com>:
>
>> Hi David,
>>
>> sorry but I am still confused. I had a look at the 3.0.0 users-guide/kar
>> and it says to put the feature.xml into src/main/resources:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
>>
>>     <modelVersion>4.0.0</modelVersion>
>>
>>     <groupId>my.groupId</groupId>
>>     <artifactId>my-kar</artifactId>
>>     <version>1.0</version>
>>     <packaging>pom</packaging>
>>
>>     <build>
>>         <plugins>
>>             <plugin>
>>                 <groupId>org.apache.karaf.tooling</groupId>
>>                 <artifactId>karaf-maven-plugin</artifactId>
>>                 <version>3.0.0-SNAPSHOT</version>
>>                 <executions>
>>                     <execution>
>>                         <id>features-create-kar</id>
>>                         <goals>
>>                             <goal>features-create-kar</goal>
>>                         </goals>
>>                         <configuration>
>>                             <featuresFile>src/main/resources/features.xml</featuresFile>
>>                         </configuration>
>>                     </execution>
>>                 </executions>
>>             </plugin>
>>         </plugins>
>>     </build>
>>
>> </project>
>>
>> Can you give me an example with src/main/feature or how to use the plugin
>> with dependencies as features ?
>>
>> Thanks and Regards,
>> Michael
>>
>>
>> 2012/1/12 David Jencks <david_jencks@yahoo.com>
>>
>>> Hi Michael,
>>>
>>> I'm still slightly confused because 3.0.0 does not have a
>>> feature-maven-plugin, it has a karaf-maven-plugin.
>>>
>>> Using the 3.0.0 karaf-maven-plugin, put your source feature.xml in
>>> src/main/feature/feature.xml, NOT src/main/resources/feature.xml.  It will
>>> get filtered before the feature generation from maven dependencies takes
>>> place.
>>>
>>> Use the kar packaging as explained in the 3.0.0 manual.
>>>
>>> Unless you need different start-levels for different bundles, or
>>> something like config information in the feature descriptor, you can have
>>> the plugin generate the entire feature.xml from maven dependencies.
>>>
>>> hope this helps
>>> david jencks
>>>
>>>
>>> On Jan 12, 2012, at 12:35 AM, Michael Täschner wrote:
>>>
>>> Hi again,
>>>
>>> sorry for any confusion, I hope to clarify my goals and approach. My
>>> goal is to generate kar archive for my multimodule project to deploy them
>>> at runtime as self-contained features. For this I set up a module for
>>> generating the kar from a filtered feature file to manage the version
>>> information of the project.
>>>
>>> I started using "archive-kar" goal of feature-maven-plugin of
>>> 3.0.0.SNAPSHOT with the feature.xml residing in src/main/resources. As the
>>> feature.xml has to be filtered first, I refer to the filtered file as input
>>> for the plugin:
>>>
>>> <featuresFile>${project.build.outputDirectory}/features.xml</featuresFile>
>>>
>>> JB recommended using "create-kar" goal of released karaf
>>> feature-maven-plugin (tried with 2.2.5) and the feature.xml in the same
>>> folder.
>>>
>>> The result is the same, that the final kar archive contains 2
>>> feature.xml files causing karaf to register 2 feature repositories, one for
>>> the file copied in from /target/classes and the other one from
>>> /repository/<groupid>/<artifactId> ...
>>>
>>> My question was then if one of them could be removed from the kar file
>>> to prevent duplicate feature repository entries.
>>>
>>> Feature file (example):
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <features name="${project.artifactId}-${project.version}" xmlns="
>>> http://karaf.apache.org/xmlns/features/v1.0.0">
>>>   <feature name='${project.artifactId}' version='${project.version}' >
>>>     <bundle>mvn:${project.groupId}/common/${project.version}</bundle>
>>>
>>> <bundle>mvn:${project.groupId}/businessLogic/${project.version}</bundle>
>>>     <bundle>mvn:${project.groupId}/webservice/${project.version}</bundle>
>>>   </feature>
>>> </features>
>>>
>>> Thanks and Regards,
>>> Michael
>>>
>>>
>>> 2012/1/11 David Jencks <david_jencks@yahoo.com>
>>>
>>>> I can't tell what you are doing since your information is inconsistent.
>>>>
>>>>  If you use the trunk (3.0.0-SNAPSHOT) karaf-maven-plugin and the kar
>>>> packaging your "source" feature.xml file should be in
>>>> src/main/feature/feature.xml.  AFAIK this works fine.
>>>>
>>>> I don't know anything about 2.2.x.
>>>>
>>>> david jencks
>>>>
>>>> On Jan 11, 2012, at 8:21 AM, Michael Täschner wrote:
>>>>
>>>> Hi JB,
>>>>
>>>> I switched to the create-kar goal of maven-features-plugin of karaf
>>>> 2.2.5, yet the issues remain: If the input feature file uses properties I
>>>> can only use the already filtered file in target/classes (I uses
>>>> ${project.artifactId}, version, etc.) else the bundles cannot be resolved.
>>>> Additionally the resulting kar still contains two feature files: the one
>>>> from build path (target/classes) and the one within /repository, still
>>>> resulting in two feature repositories being added in karaf ?
>>>>
>>>> Did I do something wrong ?
>>>>
>>>> Cheers,
>>>> Michael
>>>>
>>>> 2012/1/11 Jean-Baptiste Onofré <jb@nanthrax.net>
>>>>
>>>>> Hi Michael,
>>>>>
>>>>> my comments inline:
>>>>>
>>>>>
>>>>>  1: I use the features-maven-plugin of karaf 3.0.0-SNAPSHOT to
>>>>>> "archive-kar" my feature from a filtered features.xml file in
>>>>>> src/main/resources/feature. This works fine apart from the fact that
>>>>>> the
>>>>>> resulting kar contains two features.xml, one in /features (as copied
>>>>>> from /target/classes/feature) and one in the correct place under
>>>>>> /repository/<groupId>/<**artifactId>-features.xml. How
can I tell the
>>>>>> plugin to ignore the /target/feature/features.xml in the kar while
I
>>>>>> still need it for the build ? Right now karaf shows two added feature
>>>>>> repositories for the same bundles and I have to remove one manually.
>>>>>>
>>>>>
>>>>> The create-kar goal is now available with features-maven-plugin 2.2.5.
>>>>>
>>>>> http://karaf.apache.org/**manual/latest-2.2.x/users-**guide/kar.html<http://karaf.apache.org/manual/latest-2.2.x/users-guide/kar.html>
>>>>>
>>>>> I blogged about it:
>>>>> http://blog.nanthrax.net/2011/**12/do-you-know-the-apache-**
>>>>> karaf-maven-plugins/<http://blog.nanthrax.net/2011/12/do-you-know-the-apache-karaf-maven-plugins/>
>>>>>
>>>>> The create-kar goal take the featuresFile, so it should include only
>>>>> this one, and you shouldn't use a resource for that.
>>>>>
>>>>>
>>>>>
>>>>>> 2. Undeploy of kar from the karaf /deploy folder has currently no
>>>>>> effect, neither the feature repo, nor the features/bundles themselves
>>>>>> are undeployed ? Additionally I wonder what would happen if I copy
a
>>>>>> newer kar of my features to the /deploy folder ?!
>>>>>>
>>>>>
>>>>> It's an expected behavior. Removing a kar file doesn't remove the
>>>>> features installed (and the bundles/config associated).
>>>>> On Karaf 2.2.x, the kar is uncompress in the local-repo folder, adding
>>>>> a .timestamp.
>>>>> If you copy a new KAR, the KarDeployer will check if the kar is newer
>>>>> than the previous .timestamp and so it will try to update the
>>>>> features/bundles. Else, nothing will be performed.
>>>>>
>>>>> Regards
>>>>> JB
>>>>>
>>>>>
>>>>>
>>>>>> I am grateful for any answer and look forward to hearing from you.
>>>>>>
>>>>>> Kind Regards,
>>>>>> Michael
>>>>>>
>>>>>
>>>>> --
>>>>> Jean-Baptiste Onofré
>>>>> jbonofre@apache.org
>>>>> http://blog.nanthrax.net
>>>>> Talend - http://www.talend.com
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>
>

Mime
View raw message