You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Michael Täschner <m....@googlemail.com> on 2012/01/11 16:05:57 UTC

Duplicate feature repository entry using archive-kar to build deployable applications

Hi All,

I am currently experimenting with a customized karaf distribution where I
want to deploy/undeploy features at runtime using .kar archives.
Unfortunately I ran into some issues and hope to get some help here.

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.

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 ?!

I am grateful for any answer and look forward to hearing from you.

Kind Regards,
Michael

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Agree,

For now, I'm working to package a profile as a kar.

Ready to discuss (later today, I'm with a customer).

Regards
JB

On 01/12/2012 09:25 AM, Łukasz Dywicki wrote:
> The initial idea behind profiles was to use its definition also during build time. We'll definitely have a conflict areas - between FeaturesService, Kars and Profiles. All three can provide configuration resources, kars can be also used during build time. Maybe it's time to clarify who does what? :)
>
> Łukasz Dywicki
> --
> Code-House
> http://code-house.org
>
>
> Wiadomość napisana przez David Jencks w dniu 2012-01-11, o godz. 17:37:
>
>> 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
>>>
>>> I blogged about it:
>>> 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
>>>
>>
>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Łukasz Dywicki <lu...@code-house.org>.
The initial idea behind profiles was to use its definition also during build time. We'll definitely have a conflict areas - between FeaturesService, Kars and Profiles. All three can provide configuration resources, kars can be also used during build time. Maybe it's time to clarify who does what? :)

Łukasz Dywicki
--
Code-House
http://code-house.org


Wiadomość napisana przez David Jencks w dniu 2012-01-11, o godz. 17:37:

> 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
>> 
>> I blogged about it:
>> 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
>> 
> 


Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Your execution phase look correct, attach-artifact should not have effect.

Anyway, thanks for your pom, I will try to reproduce your issue.

Regards
JB

On 01/19/2012 02:13 PM, Michael Täschner wrote:
> Hi JB,
>
> can you elaborate on this? Here is my pom:
>
> <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>
> <parent>
> <artifactId>serviceRegistration</artifactId>
> <groupId>com.lhsystems.gsp.app</groupId>
> <version>1.0.0-SNAPSHOT</version>
> </parent>
> <groupId>com.lhsystems.gsp.app.serviceRegistration</groupId>
> <artifactId>serviceRegistration</artifactId>
> <version>1.0.0-SNAPSHOT</version>
> <name>GSP ServiceRegistration Provision</name>
> <description>GSP ServiceRegistration Provision Karaf Feature
> (.kar)</description>
> <packaging>pom</packaging>
>
> <build>
> <resources>
> <resource>
> <directory>src/main/resources</directory>
> <filtering>true</filtering>
> <includes>
> <include>**/*.xml</include>
> <include>**/*.properties</include>
> <include>**/*.composite</include>
> </includes>
> </resource>
> <resource>
> <directory>src/main/resources</directory>
> <filtering>false</filtering>
> <excludes>
> <exclude>**/*.xml</exclude>
> <exclude>**/*.properties</exclude>
> <exclude>**/*.composite</exclude>
> </excludes>
> </resource>
> </resources>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-resources-plugin</artifactId>
> <executions>
> <execution>
> <id>filter</id>
> <phase>generate-resources</phase>
> <goals>
> <goal>resources</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> <plugin>
> <groupId>org.apache.karaf.tooling</groupId>
> <artifactId>features-maven-plugin</artifactId>
> <version>2.2.5</version>
> <executions>
> <execution>
> <id>create-kar</id>
> <phase>process-resources</phase>
> <goals>
> <goal>create-kar</goal>
> </goals>
> <configuration>
> <resourcesDir>${project.build.directory}/doesNotExist</resourcesDir>
> <includeDependencies>false</includeDependencies>
> <featuresFile>${project.build.outputDirectory}/feature.xml</featuresFile>
> </configuration>
> </execution>
> </executions>
> </plugin>
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>build-helper-maven-plugin</artifactId>
> <version>1.7</version>
> <executions>
> <execution>
> <id>attach-artifacts</id>
> <phase>package</phase>
> <goals>
> <goal>attach-artifact</goal>
> </goals>
> <configuration>
> <artifacts>
> <artifact>
> <file>target/classes/feature.xml</file>
> <type>xml</type>
> <classifier>features</classifier>
> </artifact>
> </artifacts>
> </configuration>
> </execution>
> <execution>
> <id>attach-composite</id>
> <phase>package</phase>
> <goals>
> <goal>attach-artifact</goal>
> </goals>
> <configuration>
> <artifacts>
> <artifact>
> <file>target/classes/serviceRegistration.composite</file>
> <type>composite</type>
> </artifact>
> </artifacts>
> </configuration>
> </execution>
> </executions>
> </plugin>
> <!-- TODO: Karaf Maven Plugin Alternative -->
> <!-- set <packaging>kar</packaging> -->
> <!-- put feature.xml in src/main/feature -->
> <!--
> <plugin>
> <groupId>org.apache.karaf.tooling</groupId>
> <artifactId>karaf-maven-plugin</artifactId>
> <version>3.0.0-SNAPSHOT</version>
> <extensions>true</extensions>
> <executions>
> <execution>
> <id>archive-kar</id>
> <goals>
> <goal>features-create-kar</goal>
> </goals>
> <configuration>
> </configuration>
> </execution>
> </executions>
> </plugin>
>         -->
> </plugins>
> </build>
> </project>
>
> Thanks and Regards,
> Michael
>
> 2012/1/19 Jean-Baptiste Onofré <jb@nanthrax.net <ma...@nanthrax.net>>
>
>     It depends of the execution phase.
>
>     Regards
>     JB
>
>
>     On 01/19/2012 02:03 PM, Michael Täschner wrote:
>
>         Hi JB,
>
>         yes I use "pom" packaging. Only difference may be that I also have
>         buildhelper-maven-plugin configured with "attach-artifact" of the
>         feature.xml so it can alternatively be resolved in karaf when adding
>         feature repository url instead of deploying the kar file.
>
>         Regards,
>         Michael
>
>         2012/1/19 Jean-Baptiste Onofré <jb@nanthrax.net
>         <ma...@nanthrax.net> <mailto:jb@nanthrax.net
>         <ma...@nanthrax.net>>>
>
>
>             Do you use the pom packaging ?
>
>             Regards
>             JB
>
>
>             On 01/19/2012 01:44 PM, Michael Täschner wrote:
>
>                 Hi JB,
>
>                 I played around with the plugin configuration and set the
>         "resourcesDir"
>                 to a path that does not exist
>                 (${project.build.directory}/____doesNotExist).
>
>                 As a result the feature.xml from within /target/classes
>         is now
>                 ignored.
>                 I know it's a hack - I would have rather have the option
>         to omit
>                 content
>                 of target/classes or have the filtered feature.xml
>         located somewhere
>                 else, but it works for the moment.
>
>                 Best Regards,
>                 Michael
>
>                 2012/1/19 Jean-Baptiste Onofré <jb@nanthrax.net
>         <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>>
>
>
>                     Hi Michael,
>
>                     sorry I didn't see your latest message.
>
>                     Let me try a test case on my box.
>
>                     Regards
>                     JB
>
>
>                     On 01/19/2012 01:12 PM, Michael Täschner wrote:
>
>                         Hi JB,
>
>                         have you read my previous response? Using the
>         "create-kar" of
>                         feature-maven-plugin of karaf 2.2.x as you described
>                 above, adds the
>                         feature.xml twice to the resulting kar file. As
>         a result
>                 two feature
>                         repositories are registered in karaf.
>
>                         Right now karaf-maven-plugin 3.0.0-SNAPSHOT
>         seems to be
>                 broken so I
>                         tried again with the feature-maven-plugin, but the
>                 problem persists.
>
>                         Do you have an idea how to prevent this
>         duplication ?
>
>                         Thanks and Regards,
>                         Michael
>
>                         Am 13. Januar 2012 11:18 schrieb Michael Täschner
>         <m.taeschner@googlemail.com <ma...@googlemail.com>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@googlemail.com>>
>         <mailto:m.taeschner@ <mailto:m.taeschner@>__googlema__il.com
>         <http://googlemail.com>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@googlemail.com>>>
>         <mailto:m.taeschner@ <mailto:m.taeschner@> <mailto:m.taeschner@
>         <mailto:m.taeschner@>>__googlem__a__il.com <http://googlema__il.com>
>         <http://googlemail.com>
>         <mailto:m.taeschner@ <mailto:m.taeschner@>__googlema__il.com
>         <http://googlemail.com>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@googlemail.com>>>>>:
>
>
>                             Hi JB,
>
>                             yes I also got the create-kar goal of
>                 feature-maven-plugin
>                         of karaf
>                             2.2.x working as you describe above. As a result
>                 though the
>                             feature.xml is added twice to the resulting kar
>                 file, once
>                         in root
>                             folder (because of being available in
>                 target/classes) and
>                         secondly
>                             within the /repository path because it is
>         defined as
>                 feature
>                             description within the feature.xml. As a
>         result on
>                         deployment the
>                             feature url/repository is added twice to the
>         karaf
>                 container
>                         which
>                             was my original question.
>
>                             Thanks and Regards,
>                             Michael
>
>
>                             2012/1/12 Jean-Baptiste Onofré
>         <jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>>>
>
>
>                                 Hi Michael,
>
>                                 Using features-maven-plugin 2.2.5, you
>         have to do
>                         something like
>
>                                 1. The define a filtered-resources
>         folder in the
>                 resources
>                                 containing the features.xml file:
>
>         <build>
>         <resources>
>         <resource>
>         <directory>src/main/filtered-________resources</directory>
>
>
>
>         <filtered>true</filtered>
>         </resource>
>         </resources>
>                                 [...]
>
>                                 2. As the packaging is pom
>                 (<packaging>pom</packaging>),
>                         we need
>                                 to execute the dependency plugin
>         "explicitly":
>
>         <plugins>
>         <plugin>
>         <groupId>org.apache.maven.________plugins</groupId>
>         <artifactId>maven-resources-________plugin</artifactId>
>
>
>
>         <executions>
>         <execution>
>         <id>filter</id>
>         <phase>generate-resources</________phase>
>
>
>
>         <goals>
>         <goal>resources</goal>
>         </goals>
>         </execution>
>         </executions>
>         </plugin>
>
>                                 3. Now you can define the featuresFile
>         in the
>                 create-kar
>                         goal on
>                                 the process-resources phase:
>
>         <plugin>
>         <groupId>org.apache.karaf.________tooling</groupId>
>         <artifactId>features-maven-________plugin</artifactId>
>
>
>
>         <version>2.2.5</version>
>         <executions>
>         <execution>
>         <id>create-kar</id>
>         <phase>process-resources</________phase>
>
>
>
>         <goals>
>         <goal>create-kar</goal>
>         </goals>
>         <configuration>
>
>         <featuresFile>${basedir}/________target/classes/features.xml</________featuresFile>
>
>
>
>         </configuration>
>         </execution>
>         </executions>
>         </plugin>
>
>                                 Regards
>                                 JB
>
>
>                                 On 01/12/2012 02:12 PM, 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 <ma...@googlemail.com>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@googlemail.com>>
>         <mailto:m.taeschner@ <mailto:m.taeschner@>__googlema__il.com
>         <http://googlemail.com>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@googlemail.com>>>
>         <mailto:m.taeschner@ <mailto:m.taeschner@> <mailto:m.taeschner@
>         <mailto:m.taeschner@>>__googlem__a__il.com <http://googlema__il.com>
>         <http://googlemail.com>
>         <mailto:m.taeschner@ <mailto:m.taeschner@>__googlema__il.com
>         <http://googlemail.com>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@googlemail.com>>>>
>         <mailto:m.taeschner@ <mailto:m.taeschner@> <mailto:m.taeschner@
>         <mailto:m.taeschner@>> <mailto:m.taeschner@ <mailto:m.taeschner@>
>         <mailto:m.taeschner@
>         <mailto:m.taeschner@>>>__google__m__a__il.com
>         <http://googlem__a__il.com> <http://googlema__il.com>
>         <http://googlemail.com>
>
>
>
>         <mailto:m.taeschner@ <mailto:m.taeschner@> <mailto:m.taeschner@
>         <mailto:m.taeschner@>>__googlem__a__il.com <http://googlema__il.com>
>         <http://googlemail.com>
>         <mailto:m.taeschner@ <mailto:m.taeschner@>__googlema__il.com
>         <http://googlemail.com>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@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
>         <http://maven.apache.org/POM/______4.0.0
>         <http://maven.apache.org/POM/____4.0.0>
>         <http://maven.apache.org/POM/____4.0.0
>         <http://maven.apache.org/POM/__4.0.0>>
>         <http://maven.apache.org/POM/____4.0.0
>         <http://maven.apache.org/POM/__4.0.0>
>         <http://maven.apache.org/POM/__4.0.0
>         <http://maven.apache.org/POM/4.0.0>>>>"
>
>
>
>           xmlns:xsi="http://www.w3.org/________2001/XMLSchema-instance
>         <http://www.w3.org/______2001/XMLSchema-instance>
>         <http://www.w3.org/____2001/__XMLSchema-instance
>         <http://www.w3.org/____2001/XMLSchema-instance>>
>         <http://www.w3.org/__2001/____XMLSchema-instance
>         <http://www.w3.org/__2001/__XMLSchema-instance>
>         <http://www.w3.org/__2001/__XMLSchema-instance
>         <http://www.w3.org/__2001/XMLSchema-instance>>>
>         <http://www.w3.org/2001/______XMLSchema-instance
>         <http://www.w3.org/2001/____XMLSchema-instance>
>         <http://www.w3.org/2001/____XMLSchema-instance
>         <http://www.w3.org/2001/__XMLSchema-instance>>
>         <http://www.w3.org/2001/____XMLSchema-instance
>         <http://www.w3.org/2001/__XMLSchema-instance>
>         <http://www.w3.org/2001/__XMLSchema-instance
>         <http://www.w3.org/2001/XMLSchema-instance>>>>"
>
>
>
>           xsi:schemaLocation="http://__m______aven.apache.org/POM/4.0.0
>         <http://m____aven.apache.org/POM/4.0.0>
>         <http://m__aven.apache.org/__POM/4.0.0
>         <http://m__aven.apache.org/POM/4.0.0>>
>         <http://maven.apache.org/POM/____4.0.0
>         <http://maven.apache.org/POM/__4.0.0>
>         <http://maven.apache.org/POM/__4.0.0
>         <http://maven.apache.org/POM/4.0.0>>>
>         <http://maven.apache.org/POM/______4.0.0
>         <http://maven.apache.org/POM/____4.0.0>
>         <http://maven.apache.org/POM/____4.0.0
>         <http://maven.apache.org/POM/__4.0.0>>
>         <http://maven.apache.org/POM/____4.0.0
>         <http://maven.apache.org/POM/__4.0.0>
>         <http://maven.apache.org/POM/__4.0.0
>         <http://maven.apache.org/POM/4.0.0>>>>
>         http://maven.apache.org/xsd/________maven-4.0.0.xsd
>         <http://maven.apache.org/xsd/______maven-4.0.0.xsd>
>         <http://maven.apache.org/xsd/______maven-4.0.0.xsd
>         <http://maven.apache.org/xsd/____maven-4.0.0.xsd>>
>
>         <http://maven.apache.org/xsd/______maven-4.0.0.xsd
>         <http://maven.apache.org/xsd/____maven-4.0.0.xsd>
>         <http://maven.apache.org/xsd/____maven-4.0.0.xsd
>         <http://maven.apache.org/xsd/__maven-4.0.0.xsd>>>
>         <http://maven.apache.org/xsd/______maven-4.0.0.xsd
>         <http://maven.apache.org/xsd/____maven-4.0.0.xsd>
>         <http://maven.apache.org/xsd/____maven-4.0.0.xsd
>         <http://maven.apache.org/xsd/__maven-4.0.0.xsd>>
>         <http://maven.apache.org/xsd/____maven-4.0.0.xsd
>         <http://maven.apache.org/xsd/__maven-4.0.0.xsd>
>         <http://maven.apache.org/xsd/__maven-4.0.0.xsd
>         <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 <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com
>         <ma...@yahoo.com>__>__>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com
>         <ma...@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
>
>         <http://karaf.apache.org/______xmlns/features/v1.0.0
>         <http://karaf.apache.org/____xmlns/features/v1.0.0>
>         <http://karaf.apache.org/____xmlns/features/v1.0.0
>         <http://karaf.apache.org/__xmlns/features/v1.0.0>>
>
>
>         <http://karaf.apache.org/____xmlns/features/v1.0.0
>         <http://karaf.apache.org/__xmlns/features/v1.0.0>
>         <http://karaf.apache.org/__xmlns/features/v1.0.0
>         <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 <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com
>         <ma...@yahoo.com>__>__>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com
>         <ma...@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 <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@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>
>         <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>>
>
>         <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>
>         <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>>>
>
>         <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>
>         <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>>
>         <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>
>         <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>>>>
>
>
>         <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>
>         <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>>
>         <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>
>         <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>>>
>         <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>
>         <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>>
>         <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>
>         <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/>
>         <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/>>
>         <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/>
>         <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/>>>
>         <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/>
>         <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/>>
>         <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/>
>         <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/>>__>__>
>
>         <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/>
>         <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/>>
>
>         <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/>
>         <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/>>>
>
>
>         <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/>
>         <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/>>
>         <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/>
>         <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 <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>>>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>>
>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>>>__>
>
>         http://blog.nanthrax.net <http://blog.nanthrax.net/>
>                                                             Talend -
>         http://www.talend.com
>         <http://www.talend.com/>
>
>
>
>
>
>
>
>
>                                 --
>                                 Jean-Baptiste Onofré
>         jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>>>
>
>         http://blog.nanthrax.net
>                                 Talend - http://www.talend.com
>
>
>
>
>                     --
>                     Jean-Baptiste Onofré
>         jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>>
>         http://blog.nanthrax.net
>                     Talend - http://www.talend.com
>
>
>
>             --
>             Jean-Baptiste Onofré
>         jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>
>         http://blog.nanthrax.net
>             Talend - http://www.talend.com
>
>
>
>     --
>     Jean-Baptiste Onofré
>     jbonofre@apache.org <ma...@apache.org>
>     http://blog.nanthrax.net
>     Talend - http://www.talend.com
>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Michael Täschner <m....@googlemail.com>.
Hi JB,

can you elaborate on this? Here is my pom:

<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>
  <parent>
    <artifactId>serviceRegistration</artifactId>
    <groupId>com.lhsystems.gsp.app</groupId>
    <version>1.0.0-SNAPSHOT</version>
  </parent>
  <groupId>com.lhsystems.gsp.app.serviceRegistration</groupId>
  <artifactId>serviceRegistration</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <name>GSP ServiceRegistration Provision</name>
  <description>GSP ServiceRegistration Provision Karaf Feature
(.kar)</description>
  <packaging>pom</packaging>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>**/*.xml</include>
          <include>**/*.properties</include>
          <include>**/*.composite</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>false</filtering>
        <excludes>
          <exclude>**/*.xml</exclude>
          <exclude>**/*.properties</exclude>
          <exclude>**/*.composite</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>filter</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.karaf.tooling</groupId>
        <artifactId>features-maven-plugin</artifactId>
        <version>2.2.5</version>
        <executions>
          <execution>
            <id>create-kar</id>
            <phase>process-resources</phase>
            <goals>
              <goal>create-kar</goal>
            </goals>
            <configuration>

<resourcesDir>${project.build.directory}/doesNotExist</resourcesDir>
              <includeDependencies>false</includeDependencies>

<featuresFile>${project.build.outputDirectory}/feature.xml</featuresFile>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.7</version>
        <executions>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>target/classes/feature.xml</file>
                  <type>xml</type>
                  <classifier>features</classifier>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
          <execution>
            <id>attach-composite</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>target/classes/serviceRegistration.composite</file>
                  <type>composite</type>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- TODO: Karaf Maven Plugin Alternative -->
      <!-- set <packaging>kar</packaging> -->
      <!-- put feature.xml in src/main/feature -->
      <!--
      <plugin>
        <groupId>org.apache.karaf.tooling</groupId>
        <artifactId>karaf-maven-plugin</artifactId>
        <version>3.0.0-SNAPSHOT</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>archive-kar</id>
            <goals>
              <goal>features-create-kar</goal>
            </goals>
            <configuration>
            </configuration>
          </execution>
        </executions>
      </plugin>
       -->
    </plugins>
  </build>
</project>

Thanks and Regards,
Michael

2012/1/19 Jean-Baptiste Onofré <jb...@nanthrax.net>

> It depends of the execution phase.
>
> Regards
> JB
>
>
> On 01/19/2012 02:03 PM, Michael Täschner wrote:
>
>> Hi JB,
>>
>> yes I use "pom" packaging. Only difference may be that I also have
>> buildhelper-maven-plugin configured with "attach-artifact" of the
>> feature.xml so it can alternatively be resolved in karaf when adding
>> feature repository url instead of deploying the kar file.
>>
>> Regards,
>> Michael
>>
>> 2012/1/19 Jean-Baptiste Onofré <jb@nanthrax.net <ma...@nanthrax.net>>
>>
>>
>>    Do you use the pom packaging ?
>>
>>    Regards
>>    JB
>>
>>
>>    On 01/19/2012 01:44 PM, Michael Täschner wrote:
>>
>>        Hi JB,
>>
>>        I played around with the plugin configuration and set the
>>        "resourcesDir"
>>        to a path that does not exist
>>        (${project.build.directory}/__**doesNotExist).
>>
>>        As a result the feature.xml from within /target/classes is now
>>        ignored.
>>        I know it's a hack - I would have rather have the option to omit
>>        content
>>        of target/classes or have the filtered feature.xml located
>> somewhere
>>        else, but it works for the moment.
>>
>>        Best Regards,
>>        Michael
>>
>>        2012/1/19 Jean-Baptiste Onofré <jb@nanthrax.net
>>        <ma...@nanthrax.net> <mailto:jb@nanthrax.net
>>        <ma...@nanthrax.net>>>
>>
>>
>>            Hi Michael,
>>
>>            sorry I didn't see your latest message.
>>
>>            Let me try a test case on my box.
>>
>>            Regards
>>            JB
>>
>>
>>            On 01/19/2012 01:12 PM, Michael Täschner wrote:
>>
>>                Hi JB,
>>
>>                have you read my previous response? Using the
>>        "create-kar" of
>>                feature-maven-plugin of karaf 2.2.x as you described
>>        above, adds the
>>                feature.xml twice to the resulting kar file. As a result
>>        two feature
>>                repositories are registered in karaf.
>>
>>                Right now karaf-maven-plugin 3.0.0-SNAPSHOT seems to be
>>        broken so I
>>                tried again with the feature-maven-plugin, but the
>>        problem persists.
>>
>>                Do you have an idea how to prevent this duplication ?
>>
>>                Thanks and Regards,
>>                Michael
>>
>>                Am 13. Januar 2012 11:18 schrieb Michael Täschner
>>        <m.taeschner@googlemail.com <ma...@googlemail.com>
>> >
>>        <mailto:m.taeschner@__googlema**il.com <http://googlemail.com>
>>        <mailto:m.taeschner@**googlemail.com <m....@googlemail.com>
>> >>
>>        <mailto:m.taeschner@ <mailto:m.taeschner@>__googlem**a__il.com<http://googlema__il.com>
>>        <http://googlemail.com>
>>        <mailto:m.taeschner@__googlema**il.com <http://googlemail.com>
>>        <mailto:m.taeschner@**googlemail.com <m....@googlemail.com>
>> >>>>:
>>
>>
>>                    Hi JB,
>>
>>                    yes I also got the create-kar goal of
>>        feature-maven-plugin
>>                of karaf
>>                    2.2.x working as you describe above. As a result
>>        though the
>>                    feature.xml is added twice to the resulting kar
>>        file, once
>>                in root
>>                    folder (because of being available in
>>        target/classes) and
>>                secondly
>>                    within the /repository path because it is defined as
>>        feature
>>                    description within the feature.xml. As a result on
>>                deployment the
>>                    feature url/repository is added twice to the karaf
>>        container
>>                which
>>                    was my original question.
>>
>>                    Thanks and Regards,
>>                    Michael
>>
>>
>>                    2012/1/12 Jean-Baptiste Onofré <jb@nanthrax.net
>>        <ma...@nanthrax.net>
>>        <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>        <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>>        <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>>
>>
>>
>>                        Hi Michael,
>>
>>                        Using features-maven-plugin 2.2.5, you have to do
>>                something like
>>
>>                        1. The define a filtered-resources folder in the
>>        resources
>>                        containing the features.xml file:
>>
>>        <build>
>>        <resources>
>>        <resource>
>>        <directory>src/main/filtered-_**_____resources</directory>
>>
>>
>>
>>        <filtered>true</filtered>
>>        </resource>
>>        </resources>
>>                        [...]
>>
>>                        2. As the packaging is pom
>>        (<packaging>pom</packaging>),
>>                we need
>>                        to execute the dependency plugin "explicitly":
>>
>>        <plugins>
>>        <plugin>
>>        <groupId>org.apache.maven.____**__plugins</groupId>
>>        <artifactId>maven-resources-__**____plugin</artifactId>
>>
>>
>>
>>        <executions>
>>        <execution>
>>        <id>filter</id>
>>        <phase>generate-resources</___**___phase>
>>
>>
>>
>>        <goals>
>>        <goal>resources</goal>
>>        </goals>
>>        </execution>
>>        </executions>
>>        </plugin>
>>
>>                        3. Now you can define the featuresFile in the
>>        create-kar
>>                goal on
>>                        the process-resources phase:
>>
>>        <plugin>
>>        <groupId>org.apache.karaf.____**__tooling</groupId>
>>        <artifactId>features-maven-___**___plugin</artifactId>
>>
>>
>>
>>        <version>2.2.5</version>
>>        <executions>
>>        <execution>
>>        <id>create-kar</id>
>>        <phase>process-resources</____**__phase>
>>
>>
>>
>>        <goals>
>>        <goal>create-kar</goal>
>>        </goals>
>>        <configuration>
>>
>>        <featuresFile>${basedir}/_____**_target/classes/features.xml</**
>> ______featuresFile>
>>
>>
>>
>>        </configuration>
>>        </execution>
>>        </executions>
>>        </plugin>
>>
>>                        Regards
>>                        JB
>>
>>
>>                        On 01/12/2012 02:12 PM, 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 <ma...@googlemail.com>
>> >
>>        <mailto:m.taeschner@__googlema**il.com <http://googlemail.com>
>>        <mailto:m.taeschner@**googlemail.com <m....@googlemail.com>
>> >>
>>        <mailto:m.taeschner@ <mailto:m.taeschner@>__googlem**a__il.com<http://googlema__il.com>
>>        <http://googlemail.com>
>>        <mailto:m.taeschner@__googlema**il.com <http://googlemail.com>
>>        <mailto:m.taeschner@**googlemail.com <m....@googlemail.com>
>> >>>
>>        <mailto:m.taeschner@ <mailto:m.taeschner@> <mailto:m.taeschner@
>>        <mailto:m.taeschner@>>__google**m__a__il.com<http://googlem__a__il.com><
>> http://googlema__il.com>
>>        <http://googlemail.com>
>>
>>
>>
>>        <mailto:m.taeschner@ <mailto:m.taeschner@>__googlem**a__il.com<http://googlema__il.com>
>>        <http://googlemail.com>
>>        <mailto:m.taeschner@__googlema**il.com <http://googlemail.com>
>>        <mailto:m.taeschner@**googlemail.com <m....@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
>>        <http://maven.apache.org/POM/_**___4.0.0<http://maven.apache.org/POM/____4.0.0>
>>        <http://maven.apache.org/POM/_**_4.0.0<http://maven.apache.org/POM/__4.0.0>
>> >
>>        <http://maven.apache.org/POM/_**_4.0.0<http://maven.apache.org/POM/__4.0.0>
>>        <http://maven.apache.org/POM/**4.0.0<http://maven.apache.org/POM/4.0.0>
>> >>>"
>>
>>
>>          xmlns:xsi="http://www.w3.org/_**_____2001/XMLSchema-instance<http://www.w3.org/______2001/XMLSchema-instance>
>>        <http://www.w3.org/____2001/**XMLSchema-instance<http://www.w3.org/____2001/XMLSchema-instance>
>> >
>>        <http://www.w3.org/__2001/__**XMLSchema-instance<http://www.w3.org/__2001/__XMLSchema-instance>
>>        <http://www.w3.org/__2001/**XMLSchema-instance<http://www.w3.org/__2001/XMLSchema-instance>
>> >>
>>        <http://www.w3.org/2001/____**XMLSchema-instance<http://www.w3.org/2001/____XMLSchema-instance>
>>        <http://www.w3.org/2001/__**XMLSchema-instance<http://www.w3.org/2001/__XMLSchema-instance>
>> >
>>        <http://www.w3.org/2001/__**XMLSchema-instance<http://www.w3.org/2001/__XMLSchema-instance>
>>        <http://www.w3.org/2001/**XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>
>> >>>"
>>
>>
>>          xsi:schemaLocation="http://__m**____aven.apache.org/POM/4.0.0<http://m____aven.apache.org/POM/4.0.0>
>>        <http://m__aven.apache.org/**POM/4.0.0<http://m__aven.apache.org/POM/4.0.0>
>> >
>>        <http://maven.apache.org/POM/_**_4.0.0<http://maven.apache.org/POM/__4.0.0>
>>        <http://maven.apache.org/POM/**4.0.0<http://maven.apache.org/POM/4.0.0>
>> >>
>>        <http://maven.apache.org/POM/_**___4.0.0<http://maven.apache.org/POM/____4.0.0>
>>        <http://maven.apache.org/POM/_**_4.0.0<http://maven.apache.org/POM/__4.0.0>
>> >
>>        <http://maven.apache.org/POM/_**_4.0.0<http://maven.apache.org/POM/__4.0.0>
>>        <http://maven.apache.org/POM/**4.0.0<http://maven.apache.org/POM/4.0.0>
>> >>>
>>        http://maven.apache.org/xsd/__**____maven-4.0.0.xsd<http://maven.apache.org/xsd/______maven-4.0.0.xsd>
>>        <http://maven.apache.org/xsd/_**___maven-4.0.0.xsd<http://maven.apache.org/xsd/____maven-4.0.0.xsd>
>> >
>>
>>        <http://maven.apache.org/xsd/_**___maven-4.0.0.xsd<http://maven.apache.org/xsd/____maven-4.0.0.xsd>
>>        <http://maven.apache.org/xsd/_**_maven-4.0.0.xsd<http://maven.apache.org/xsd/__maven-4.0.0.xsd>
>> >>
>>        <http://maven.apache.org/xsd/_**___maven-4.0.0.xsd<http://maven.apache.org/xsd/____maven-4.0.0.xsd>
>>        <http://maven.apache.org/xsd/_**_maven-4.0.0.xsd<http://maven.apache.org/xsd/__maven-4.0.0.xsd>
>> >
>>        <http://maven.apache.org/xsd/_**_maven-4.0.0.xsd<http://maven.apache.org/xsd/__maven-4.0.0.xsd>
>>        <http://maven.apache.org/xsd/**maven-4.0.0.xsd<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 <mailto:david_jencks@yahoo.com**>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**
>> >__>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**
>> >__>__>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**
>> >__>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**>
>>        <mailto:david_jencks@yahoo.com
>>        <mailto: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
>>
>>        <http://karaf.apache.org/____**xmlns/features/v1.0.0<http://karaf.apache.org/____xmlns/features/v1.0.0>
>>        <http://karaf.apache.org/__**xmlns/features/v1.0.0<http://karaf.apache.org/__xmlns/features/v1.0.0>
>> >
>>
>>
>>        <http://karaf.apache.org/__**xmlns/features/v1.0.0<http://karaf.apache.org/__xmlns/features/v1.0.0>
>>        <http://karaf.apache.org/**xmlns/features/v1.0.0<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 <mailto:david_jencks@yahoo.com**>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**
>> >__>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**
>> >__>__>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**
>> >__>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**>
>>        <mailto:david_jencks@yahoo.com
>>        <mailto: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 <ma...@nanthrax.net>
>>        <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>        <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>>        <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>
>>        <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>>        <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>        <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>>        <mailto:jb@nanthrax.net <ma...@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>
>>        <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>
>> >
>>
>>        <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>
>>        <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>
>> >>
>>
>>        <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>
>>        <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>
>> >
>>        <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>
>>        <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>
>> >>>
>>
>>
>>        <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>
>>        <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>
>> >
>>        <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>
>>        <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>
>> >>
>>        <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>
>>        <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>
>> >
>>        <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>
>>        <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/>
>>        <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/>
>> >
>>        <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/>
>>        <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/>
>> >>
>>        <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/>
>>        <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/>
>> >
>>        <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/>
>>        <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/>
>> >**>__>
>>
>>        <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/>
>>        <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/>
>> >
>>
>>        <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/>
>>        <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/>
>> >>
>>
>>
>>        <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/>
>>        <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/>
>> >
>>        <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/>
>>        <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 <ma...@apache.org>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>>>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>>
>>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>>>**>
>>
>>        http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>                                                    Talend -
>>        http://www.talend.com
>>        <http://www.talend.com/>
>>
>>
>>
>>
>>
>>
>>
>>
>>                        --
>>                        Jean-Baptiste Onofré
>>        jbonofre@apache.org <ma...@apache.org>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>>>
>>
>>        http://blog.nanthrax.net
>>                        Talend - http://www.talend.com
>>
>>
>>
>>
>>            --
>>            Jean-Baptiste Onofré
>>        jbonofre@apache.org <ma...@apache.org>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>>
>>        http://blog.nanthrax.net
>>            Talend - http://www.talend.com
>>
>>
>>
>>    --
>>    Jean-Baptiste Onofré
>>    jbonofre@apache.org <ma...@apache.org>
>>    http://blog.nanthrax.net
>>    Talend - http://www.talend.com
>>
>>
>>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
It depends of the execution phase.

Regards
JB

On 01/19/2012 02:03 PM, Michael Täschner wrote:
> Hi JB,
>
> yes I use "pom" packaging. Only difference may be that I also have
> buildhelper-maven-plugin configured with "attach-artifact" of the
> feature.xml so it can alternatively be resolved in karaf when adding
> feature repository url instead of deploying the kar file.
>
> Regards,
> Michael
>
> 2012/1/19 Jean-Baptiste Onofré <jb@nanthrax.net <ma...@nanthrax.net>>
>
>     Do you use the pom packaging ?
>
>     Regards
>     JB
>
>
>     On 01/19/2012 01:44 PM, Michael Täschner wrote:
>
>         Hi JB,
>
>         I played around with the plugin configuration and set the
>         "resourcesDir"
>         to a path that does not exist
>         (${project.build.directory}/__doesNotExist).
>         As a result the feature.xml from within /target/classes is now
>         ignored.
>         I know it's a hack - I would have rather have the option to omit
>         content
>         of target/classes or have the filtered feature.xml located somewhere
>         else, but it works for the moment.
>
>         Best Regards,
>         Michael
>
>         2012/1/19 Jean-Baptiste Onofré <jb@nanthrax.net
>         <ma...@nanthrax.net> <mailto:jb@nanthrax.net
>         <ma...@nanthrax.net>>>
>
>
>             Hi Michael,
>
>             sorry I didn't see your latest message.
>
>             Let me try a test case on my box.
>
>             Regards
>             JB
>
>
>             On 01/19/2012 01:12 PM, Michael Täschner wrote:
>
>                 Hi JB,
>
>                 have you read my previous response? Using the
>         "create-kar" of
>                 feature-maven-plugin of karaf 2.2.x as you described
>         above, adds the
>                 feature.xml twice to the resulting kar file. As a result
>         two feature
>                 repositories are registered in karaf.
>
>                 Right now karaf-maven-plugin 3.0.0-SNAPSHOT seems to be
>         broken so I
>                 tried again with the feature-maven-plugin, but the
>         problem persists.
>
>                 Do you have an idea how to prevent this duplication ?
>
>                 Thanks and Regards,
>                 Michael
>
>                 Am 13. Januar 2012 11:18 schrieb Michael Täschner
>         <m.taeschner@googlemail.com <ma...@googlemail.com>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@googlemail.com>>
>         <mailto:m.taeschner@ <mailto:m.taeschner@>__googlema__il.com
>         <http://googlemail.com>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@googlemail.com>>>>:
>
>
>                     Hi JB,
>
>                     yes I also got the create-kar goal of
>         feature-maven-plugin
>                 of karaf
>                     2.2.x working as you describe above. As a result
>         though the
>                     feature.xml is added twice to the resulting kar
>         file, once
>                 in root
>                     folder (because of being available in
>         target/classes) and
>                 secondly
>                     within the /repository path because it is defined as
>         feature
>                     description within the feature.xml. As a result on
>                 deployment the
>                     feature url/repository is added twice to the karaf
>         container
>                 which
>                     was my original question.
>
>                     Thanks and Regards,
>                     Michael
>
>
>                     2012/1/12 Jean-Baptiste Onofré <jb@nanthrax.net
>         <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>>
>
>
>                         Hi Michael,
>
>                         Using features-maven-plugin 2.2.5, you have to do
>                 something like
>
>                         1. The define a filtered-resources folder in the
>         resources
>                         containing the features.xml file:
>
>         <build>
>         <resources>
>         <resource>
>         <directory>src/main/filtered-______resources</directory>
>
>
>         <filtered>true</filtered>
>         </resource>
>         </resources>
>                         [...]
>
>                         2. As the packaging is pom
>         (<packaging>pom</packaging>),
>                 we need
>                         to execute the dependency plugin "explicitly":
>
>         <plugins>
>         <plugin>
>         <groupId>org.apache.maven.______plugins</groupId>
>         <artifactId>maven-resources-______plugin</artifactId>
>
>
>         <executions>
>         <execution>
>         <id>filter</id>
>         <phase>generate-resources</______phase>
>
>
>         <goals>
>         <goal>resources</goal>
>         </goals>
>         </execution>
>         </executions>
>         </plugin>
>
>                         3. Now you can define the featuresFile in the
>         create-kar
>                 goal on
>                         the process-resources phase:
>
>         <plugin>
>         <groupId>org.apache.karaf.______tooling</groupId>
>         <artifactId>features-maven-______plugin</artifactId>
>
>
>         <version>2.2.5</version>
>         <executions>
>         <execution>
>         <id>create-kar</id>
>         <phase>process-resources</______phase>
>
>
>         <goals>
>         <goal>create-kar</goal>
>         </goals>
>         <configuration>
>
>         <featuresFile>${basedir}/______target/classes/features.xml</______featuresFile>
>
>
>         </configuration>
>         </execution>
>         </executions>
>         </plugin>
>
>                         Regards
>                         JB
>
>
>                         On 01/12/2012 02:12 PM, 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 <ma...@googlemail.com>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@googlemail.com>>
>         <mailto:m.taeschner@ <mailto:m.taeschner@>__googlema__il.com
>         <http://googlemail.com>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@googlemail.com>>>
>         <mailto:m.taeschner@ <mailto:m.taeschner@> <mailto:m.taeschner@
>         <mailto:m.taeschner@>>__googlem__a__il.com <http://googlema__il.com>
>         <http://googlemail.com>
>
>
>         <mailto:m.taeschner@ <mailto:m.taeschner@>__googlema__il.com
>         <http://googlemail.com>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@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
>         <http://maven.apache.org/POM/____4.0.0
>         <http://maven.apache.org/POM/__4.0.0>
>         <http://maven.apache.org/POM/__4.0.0
>         <http://maven.apache.org/POM/4.0.0>>>"
>
>
>           xmlns:xsi="http://www.w3.org/______2001/XMLSchema-instance
>         <http://www.w3.org/____2001/XMLSchema-instance>
>         <http://www.w3.org/__2001/__XMLSchema-instance
>         <http://www.w3.org/__2001/XMLSchema-instance>>
>         <http://www.w3.org/2001/____XMLSchema-instance
>         <http://www.w3.org/2001/__XMLSchema-instance>
>         <http://www.w3.org/2001/__XMLSchema-instance
>         <http://www.w3.org/2001/XMLSchema-instance>>>"
>
>
>           xsi:schemaLocation="http://__m____aven.apache.org/POM/4.0.0
>         <http://m__aven.apache.org/POM/4.0.0>
>         <http://maven.apache.org/POM/__4.0.0
>         <http://maven.apache.org/POM/4.0.0>>
>         <http://maven.apache.org/POM/____4.0.0
>         <http://maven.apache.org/POM/__4.0.0>
>         <http://maven.apache.org/POM/__4.0.0
>         <http://maven.apache.org/POM/4.0.0>>>
>         http://maven.apache.org/xsd/______maven-4.0.0.xsd
>         <http://maven.apache.org/xsd/____maven-4.0.0.xsd>
>         <http://maven.apache.org/xsd/____maven-4.0.0.xsd
>         <http://maven.apache.org/xsd/__maven-4.0.0.xsd>>
>         <http://maven.apache.org/xsd/____maven-4.0.0.xsd
>         <http://maven.apache.org/xsd/__maven-4.0.0.xsd>
>         <http://maven.apache.org/xsd/__maven-4.0.0.xsd
>         <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 <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com
>         <ma...@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
>
>         <http://karaf.apache.org/____xmlns/features/v1.0.0
>         <http://karaf.apache.org/__xmlns/features/v1.0.0>
>
>         <http://karaf.apache.org/__xmlns/features/v1.0.0
>         <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 <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com
>         <ma...@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 <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@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>
>         <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>>
>
>         <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>
>         <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>>>
>
>
>         <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>
>         <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>>
>         <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>
>         <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/>
>         <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/>>
>         <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/>
>         <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/>>__>
>
>         <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/>
>         <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/>>
>
>
>         <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/>
>         <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 <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>
>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>>>
>
>         http://blog.nanthrax.net <http://blog.nanthrax.net/>
>                                                     Talend -
>         http://www.talend.com
>         <http://www.talend.com/>
>
>
>
>
>
>
>
>
>                         --
>                         Jean-Baptiste Onofré
>         jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>>
>
>         http://blog.nanthrax.net
>                         Talend - http://www.talend.com
>
>
>
>
>             --
>             Jean-Baptiste Onofré
>         jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>
>         http://blog.nanthrax.net
>             Talend - http://www.talend.com
>
>
>
>     --
>     Jean-Baptiste Onofré
>     jbonofre@apache.org <ma...@apache.org>
>     http://blog.nanthrax.net
>     Talend - http://www.talend.com
>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Michael Täschner <m....@googlemail.com>.
Hi JB,

yes I use "pom" packaging. Only difference may be that I also have
buildhelper-maven-plugin configured with "attach-artifact" of the
feature.xml so it can alternatively be resolved in karaf when adding
feature repository url instead of deploying the kar file.

Regards,
Michael

2012/1/19 Jean-Baptiste Onofré <jb...@nanthrax.net>

> Do you use the pom packaging ?
>
> Regards
> JB
>
>
> On 01/19/2012 01:44 PM, Michael Täschner wrote:
>
>> Hi JB,
>>
>> I played around with the plugin configuration and set the "resourcesDir"
>> to a path that does not exist (${project.build.directory}/**
>> doesNotExist).
>> As a result the feature.xml from within /target/classes is now ignored.
>> I know it's a hack - I would have rather have the option to omit content
>> of target/classes or have the filtered feature.xml located somewhere
>> else, but it works for the moment.
>>
>> Best Regards,
>> Michael
>>
>> 2012/1/19 Jean-Baptiste Onofré <jb@nanthrax.net <ma...@nanthrax.net>>
>>
>>
>>    Hi Michael,
>>
>>    sorry I didn't see your latest message.
>>
>>    Let me try a test case on my box.
>>
>>    Regards
>>    JB
>>
>>
>>    On 01/19/2012 01:12 PM, Michael Täschner wrote:
>>
>>        Hi JB,
>>
>>        have you read my previous response? Using the "create-kar" of
>>        feature-maven-plugin of karaf 2.2.x as you described above, adds
>> the
>>        feature.xml twice to the resulting kar file. As a result two
>> feature
>>        repositories are registered in karaf.
>>
>>        Right now karaf-maven-plugin 3.0.0-SNAPSHOT seems to be broken so I
>>        tried again with the feature-maven-plugin, but the problem
>> persists.
>>
>>        Do you have an idea how to prevent this duplication ?
>>
>>        Thanks and Regards,
>>        Michael
>>
>>        Am 13. Januar 2012 11:18 schrieb Michael Täschner
>>        <m.taeschner@googlemail.com <ma...@googlemail.com>
>> >
>>        <mailto:m.taeschner@__googlema**il.com <http://googlemail.com>
>>        <mailto:m.taeschner@**googlemail.com <m....@googlemail.com>
>> >>>:
>>
>>
>>            Hi JB,
>>
>>            yes I also got the create-kar goal of feature-maven-plugin
>>        of karaf
>>            2.2.x working as you describe above. As a result though the
>>            feature.xml is added twice to the resulting kar file, once
>>        in root
>>            folder (because of being available in target/classes) and
>>        secondly
>>            within the /repository path because it is defined as feature
>>            description within the feature.xml. As a result on
>>        deployment the
>>            feature url/repository is added twice to the karaf container
>>        which
>>            was my original question.
>>
>>            Thanks and Regards,
>>            Michael
>>
>>
>>            2012/1/12 Jean-Baptiste Onofré <jb@nanthrax.net
>>        <ma...@nanthrax.net>
>>        <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>
>>
>>
>>                Hi Michael,
>>
>>                Using features-maven-plugin 2.2.5, you have to do
>>        something like
>>
>>                1. The define a filtered-resources folder in the resources
>>                containing the features.xml file:
>>
>>        <build>
>>        <resources>
>>        <resource>
>>        <directory>src/main/filtered-_**___resources</directory>
>>
>>
>>        <filtered>true</filtered>
>>        </resource>
>>        </resources>
>>                [...]
>>
>>                2. As the packaging is pom (<packaging>pom</packaging>),
>>        we need
>>                to execute the dependency plugin "explicitly":
>>
>>        <plugins>
>>        <plugin>
>>        <groupId>org.apache.maven.____**plugins</groupId>
>>        <artifactId>maven-resources-__**__plugin</artifactId>
>>
>>
>>        <executions>
>>        <execution>
>>        <id>filter</id>
>>        <phase>generate-resources</___**_phase>
>>
>>
>>        <goals>
>>        <goal>resources</goal>
>>        </goals>
>>        </execution>
>>        </executions>
>>        </plugin>
>>
>>                3. Now you can define the featuresFile in the create-kar
>>        goal on
>>                the process-resources phase:
>>
>>        <plugin>
>>        <groupId>org.apache.karaf.____**tooling</groupId>
>>        <artifactId>features-maven-___**_plugin</artifactId>
>>
>>
>>        <version>2.2.5</version>
>>        <executions>
>>        <execution>
>>        <id>create-kar</id>
>>        <phase>process-resources</____**phase>
>>
>>
>>        <goals>
>>        <goal>create-kar</goal>
>>        </goals>
>>        <configuration>
>>
>>        <featuresFile>${basedir}/____**target/classes/features.xml</_**
>> ___featuresFile>
>>
>>
>>        </configuration>
>>        </execution>
>>        </executions>
>>        </plugin>
>>
>>                Regards
>>                JB
>>
>>
>>                On 01/12/2012 02:12 PM, 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 <ma...@googlemail.com>
>> >
>>        <mailto:m.taeschner@__googlema**il.com <http://googlemail.com>
>>        <mailto:m.taeschner@**googlemail.com <m....@googlemail.com>
>> >>
>>        <mailto:m.taeschner@ <mailto:m.taeschner@>__googlem**a__il.com<http://googlema__il.com>
>>        <http://googlemail.com>
>>
>>
>>        <mailto:m.taeschner@__googlema**il.com <http://googlemail.com>
>>        <mailto:m.taeschner@**googlemail.com <m....@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
>>        <http://maven.apache.org/POM/_**_4.0.0<http://maven.apache.org/POM/__4.0.0>
>>        <http://maven.apache.org/POM/**4.0.0<http://maven.apache.org/POM/4.0.0>
>> >>"
>>
>>          xmlns:xsi="http://www.w3.org/_**___2001/XMLSchema-instance<http://www.w3.org/____2001/XMLSchema-instance>
>>        <http://www.w3.org/__2001/**XMLSchema-instance<http://www.w3.org/__2001/XMLSchema-instance>
>> >
>>        <http://www.w3.org/2001/__**XMLSchema-instance<http://www.w3.org/2001/__XMLSchema-instance>
>>        <http://www.w3.org/2001/**XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>
>> >>"
>>
>>          xsi:schemaLocation="http://__m**__aven.apache.org/POM/4.0.0<http://m__aven.apache.org/POM/4.0.0>
>>        <http://maven.apache.org/POM/**4.0.0<http://maven.apache.org/POM/4.0.0>
>> >
>>        <http://maven.apache.org/POM/_**_4.0.0<http://maven.apache.org/POM/__4.0.0>
>>        <http://maven.apache.org/POM/**4.0.0<http://maven.apache.org/POM/4.0.0>
>> >>
>>        http://maven.apache.org/xsd/__**__maven-4.0.0.xsd<http://maven.apache.org/xsd/____maven-4.0.0.xsd>
>>        <http://maven.apache.org/xsd/_**_maven-4.0.0.xsd<http://maven.apache.org/xsd/__maven-4.0.0.xsd>
>> >
>>        <http://maven.apache.org/xsd/_**_maven-4.0.0.xsd<http://maven.apache.org/xsd/__maven-4.0.0.xsd>
>>        <http://maven.apache.org/xsd/**maven-4.0.0.xsd<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
>>        <mailto:david_jencks@yahoo.com**>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**
>> >__>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**>
>>        <mailto:david_jencks@yahoo.com
>>        <mailto: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
>>
>>        <http://karaf.apache.org/__**xmlns/features/v1.0.0<http://karaf.apache.org/__xmlns/features/v1.0.0>
>>
>>        <http://karaf.apache.org/**xmlns/features/v1.0.0<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 <mailto:david_jencks@yahoo.com**>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**
>> >__>
>>        <mailto:david_jencks@yahoo.com <mailto:david_jencks@yahoo.com**>
>>        <mailto:david_jencks@yahoo.com
>>        <mailto: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 <ma...@nanthrax.net>
>>        <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>        <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>>        <mailto:jb@nanthrax.net <ma...@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>
>>        <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>
>> >
>>
>>        <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>
>>        <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>
>> >>
>>
>>
>>        <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>
>>        <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>
>> >
>>        <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>
>>        <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/>
>>        <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/>
>> >
>>        <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/>
>>        <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/>
>> >**>
>>
>>        <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/>
>>        <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/>
>> >
>>
>>
>>        <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/>
>>        <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 <ma...@apache.org>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>
>>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>>>
>>
>>        http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>                                            Talend - http://www.talend.com
>>        <http://www.talend.com/>
>>
>>
>>
>>
>>
>>
>>
>>
>>                --
>>                Jean-Baptiste Onofré
>>        jbonofre@apache.org <ma...@apache.org>
>>        <mailto:jbonofre@apache.org <ma...@apache.org>>
>>
>>        http://blog.nanthrax.net
>>                Talend - http://www.talend.com
>>
>>
>>
>>
>>    --
>>    Jean-Baptiste Onofré
>>    jbonofre@apache.org <ma...@apache.org>
>>    http://blog.nanthrax.net
>>    Talend - http://www.talend.com
>>
>>
>>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Do you use the pom packaging ?

Regards
JB

On 01/19/2012 01:44 PM, Michael Täschner wrote:
> Hi JB,
>
> I played around with the plugin configuration and set the "resourcesDir"
> to a path that does not exist (${project.build.directory}/doesNotExist).
> As a result the feature.xml from within /target/classes is now ignored.
> I know it's a hack - I would have rather have the option to omit content
> of target/classes or have the filtered feature.xml located somewhere
> else, but it works for the moment.
>
> Best Regards,
> Michael
>
> 2012/1/19 Jean-Baptiste Onofré <jb@nanthrax.net <ma...@nanthrax.net>>
>
>     Hi Michael,
>
>     sorry I didn't see your latest message.
>
>     Let me try a test case on my box.
>
>     Regards
>     JB
>
>
>     On 01/19/2012 01:12 PM, Michael Täschner wrote:
>
>         Hi JB,
>
>         have you read my previous response? Using the "create-kar" of
>         feature-maven-plugin of karaf 2.2.x as you described above, adds the
>         feature.xml twice to the resulting kar file. As a result two feature
>         repositories are registered in karaf.
>
>         Right now karaf-maven-plugin 3.0.0-SNAPSHOT seems to be broken so I
>         tried again with the feature-maven-plugin, but the problem persists.
>
>         Do you have an idea how to prevent this duplication ?
>
>         Thanks and Regards,
>         Michael
>
>         Am 13. Januar 2012 11:18 schrieb Michael Täschner
>         <m.taeschner@googlemail.com <ma...@googlemail.com>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@googlemail.com>>>:
>
>
>             Hi JB,
>
>             yes I also got the create-kar goal of feature-maven-plugin
>         of karaf
>             2.2.x working as you describe above. As a result though the
>             feature.xml is added twice to the resulting kar file, once
>         in root
>             folder (because of being available in target/classes) and
>         secondly
>             within the /repository path because it is defined as feature
>             description within the feature.xml. As a result on
>         deployment the
>             feature url/repository is added twice to the karaf container
>         which
>             was my original question.
>
>             Thanks and Regards,
>             Michael
>
>
>             2012/1/12 Jean-Baptiste Onofré <jb@nanthrax.net
>         <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>
>
>
>                 Hi Michael,
>
>                 Using features-maven-plugin 2.2.5, you have to do
>         something like
>
>                 1. The define a filtered-resources folder in the resources
>                 containing the features.xml file:
>
>         <build>
>         <resources>
>         <resource>
>         <directory>src/main/filtered-____resources</directory>
>
>         <filtered>true</filtered>
>         </resource>
>         </resources>
>                 [...]
>
>                 2. As the packaging is pom (<packaging>pom</packaging>),
>         we need
>                 to execute the dependency plugin "explicitly":
>
>         <plugins>
>         <plugin>
>         <groupId>org.apache.maven.____plugins</groupId>
>         <artifactId>maven-resources-____plugin</artifactId>
>
>         <executions>
>         <execution>
>         <id>filter</id>
>         <phase>generate-resources</____phase>
>
>         <goals>
>         <goal>resources</goal>
>         </goals>
>         </execution>
>         </executions>
>         </plugin>
>
>                 3. Now you can define the featuresFile in the create-kar
>         goal on
>                 the process-resources phase:
>
>         <plugin>
>         <groupId>org.apache.karaf.____tooling</groupId>
>         <artifactId>features-maven-____plugin</artifactId>
>
>         <version>2.2.5</version>
>         <executions>
>         <execution>
>         <id>create-kar</id>
>         <phase>process-resources</____phase>
>
>         <goals>
>         <goal>create-kar</goal>
>         </goals>
>         <configuration>
>
>         <featuresFile>${basedir}/____target/classes/features.xml</____featuresFile>
>
>         </configuration>
>         </execution>
>         </executions>
>         </plugin>
>
>                 Regards
>                 JB
>
>
>                 On 01/12/2012 02:12 PM, 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 <ma...@googlemail.com>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@googlemail.com>>
>         <mailto:m.taeschner@ <mailto:m.taeschner@>__googlema__il.com
>         <http://googlemail.com>
>
>         <mailto:m.taeschner@__googlemail.com
>         <ma...@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
>         <http://maven.apache.org/POM/__4.0.0
>         <http://maven.apache.org/POM/4.0.0>>"
>
>           xmlns:xsi="http://www.w3.org/____2001/XMLSchema-instance
>         <http://www.w3.org/__2001/XMLSchema-instance>
>         <http://www.w3.org/2001/__XMLSchema-instance
>         <http://www.w3.org/2001/XMLSchema-instance>>"
>
>           xsi:schemaLocation="http://__m__aven.apache.org/POM/4.0.0
>         <http://maven.apache.org/POM/4.0.0>
>         <http://maven.apache.org/POM/__4.0.0
>         <http://maven.apache.org/POM/4.0.0>>
>         http://maven.apache.org/xsd/____maven-4.0.0.xsd
>         <http://maven.apache.org/xsd/__maven-4.0.0.xsd>
>         <http://maven.apache.org/xsd/__maven-4.0.0.xsd
>         <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
>         <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com
>         <ma...@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
>
>         <http://karaf.apache.org/__xmlns/features/v1.0.0
>         <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 <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>__>
>         <mailto:david_jencks@yahoo.com <ma...@yahoo.com>
>         <mailto:david_jencks@yahoo.com
>         <ma...@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 <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>         <mailto:jb@nanthrax.net <ma...@nanthrax.net>
>         <mailto:jb@nanthrax.net <ma...@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>
>         <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>>
>
>
>         <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>
>         <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/>
>         <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/>>
>
>         <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/>
>
>         <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 <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>
>         <mailto:jbonofre@apache.org <ma...@apache.org>
>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>>
>         http://blog.nanthrax.net <http://blog.nanthrax.net/>
>                                             Talend - http://www.talend.com
>         <http://www.talend.com/>
>
>
>
>
>
>
>
>
>                 --
>                 Jean-Baptiste Onofré
>         jbonofre@apache.org <ma...@apache.org>
>         <mailto:jbonofre@apache.org <ma...@apache.org>>
>
>         http://blog.nanthrax.net
>                 Talend - http://www.talend.com
>
>
>
>
>     --
>     Jean-Baptiste Onofré
>     jbonofre@apache.org <ma...@apache.org>
>     http://blog.nanthrax.net
>     Talend - http://www.talend.com
>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Michael Täschner <m....@googlemail.com>.
Hi JB,

I played around with the plugin configuration and set the "resourcesDir" to
a path that does not exist (${project.build.directory}/doesNotExist). As a
result the feature.xml from within /target/classes is now ignored. I know
it's a hack - I would have rather have the option to omit content of
target/classes or have the filtered feature.xml located somewhere else, but
it works for the moment.

Best Regards,
Michael

2012/1/19 Jean-Baptiste Onofré <jb...@nanthrax.net>

> Hi Michael,
>
> sorry I didn't see your latest message.
>
> Let me try a test case on my box.
>
> Regards
> JB
>
>
> On 01/19/2012 01:12 PM, Michael Täschner wrote:
>
>> Hi JB,
>>
>> have you read my previous response? Using the "create-kar" of
>> feature-maven-plugin of karaf 2.2.x as you described above, adds the
>> feature.xml twice to the resulting kar file. As a result two feature
>> repositories are registered in karaf.
>>
>> Right now karaf-maven-plugin 3.0.0-SNAPSHOT seems to be broken so I
>> tried again with the feature-maven-plugin, but the problem persists.
>>
>> Do you have an idea how to prevent this duplication ?
>>
>> Thanks and Regards,
>> Michael
>>
>> Am 13. Januar 2012 11:18 schrieb Michael Täschner
>> <m.taeschner@googlemail.com <ma...@googlemail.com>
>> >>:
>>
>>
>>    Hi JB,
>>
>>    yes I also got the create-kar goal of feature-maven-plugin of karaf
>>    2.2.x working as you describe above. As a result though the
>>    feature.xml is added twice to the resulting kar file, once in root
>>    folder (because of being available in target/classes) and secondly
>>    within the /repository path because it is defined as feature
>>    description within the feature.xml. As a result on deployment the
>>    feature url/repository is added twice to the karaf container which
>>    was my original question.
>>
>>    Thanks and Regards,
>>    Michael
>>
>>
>>    2012/1/12 Jean-Baptiste Onofré <jb@nanthrax.net
>>    <ma...@nanthrax.net>>
>>
>>
>>        Hi Michael,
>>
>>        Using features-maven-plugin 2.2.5, you have to do something like
>>
>>        1. The define a filtered-resources folder in the resources
>>        containing the features.xml file:
>>
>>        <build>
>>        <resources>
>>        <resource>
>>        <directory>src/main/filtered-_**_resources</directory>
>>
>>        <filtered>true</filtered>
>>        </resource>
>>        </resources>
>>        [...]
>>
>>        2. As the packaging is pom (<packaging>pom</packaging>), we need
>>        to execute the dependency plugin "explicitly":
>>
>>        <plugins>
>>        <plugin>
>>        <groupId>org.apache.maven.__**plugins</groupId>
>>        <artifactId>maven-resources-__**plugin</artifactId>
>>
>>        <executions>
>>        <execution>
>>        <id>filter</id>
>>        <phase>generate-resources</__**phase>
>>
>>        <goals>
>>        <goal>resources</goal>
>>        </goals>
>>        </execution>
>>        </executions>
>>        </plugin>
>>
>>        3. Now you can define the featuresFile in the create-kar goal on
>>        the process-resources phase:
>>
>>        <plugin>
>>        <groupId>org.apache.karaf.__**tooling</groupId>
>>        <artifactId>features-maven-__**plugin</artifactId>
>>
>>        <version>2.2.5</version>
>>        <executions>
>>        <execution>
>>        <id>create-kar</id>
>>        <phase>process-resources</__**phase>
>>
>>        <goals>
>>        <goal>create-kar</goal>
>>        </goals>
>>        <configuration>
>>
>>        <featuresFile>${basedir}/__**target/classes/features.xml</_**
>> _featuresFile>
>>
>>        </configuration>
>>        </execution>
>>        </executions>
>>        </plugin>
>>
>>        Regards
>>        JB
>>
>>
>>        On 01/12/2012 02:12 PM, 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
>>            <ma...@googlemail.com>
>> >
>>            <mailto:m.taeschner@__googlema**il.com <http://googlemail.com>
>>
>>            <ma...@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
>>            <http://maven.apache.org/POM/**4.0.0<http://maven.apache.org/POM/4.0.0>
>> >"
>>              xmlns:xsi="http://www.w3.org/_**_2001/XMLSchema-instance<http://www.w3.org/__2001/XMLSchema-instance>
>>            <http://www.w3.org/2001/**XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>
>> >"
>>              xsi:schemaLocation="http://__m**aven.apache.org/POM/4.0.0<http://maven.apache.org/POM/4.0.0>
>>            <http://maven.apache.org/POM/**4.0.0<http://maven.apache.org/POM/4.0.0>
>> >
>>            http://maven.apache.org/xsd/__**maven-4.0.0.xsd<http://maven.apache.org/xsd/__maven-4.0.0.xsd>
>>            <http://maven.apache.org/xsd/**maven-4.0.0.xsd<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
>>            <mailto:david_jencks@yahoo.com**>
>>            <mailto:david_jencks@yahoo.com
>>            <mailto: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
>>
>>                <http://karaf.apache.org/**xmlns/features/v1.0.0<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
>>                <mailto:david_jencks@yahoo.com**>
>>                <mailto:david_jencks@yahoo.com
>>                <mailto: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 <ma...@nanthrax.net>
>>                    <mailto:jb@nanthrax.net <ma...@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>
>>                    <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>
>> >
>>
>>
>>                    <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>
>>                    <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/>
>>                    <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/>
>> >
>>
>>                    <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/>
>>
>>                    <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 <ma...@apache.org>
>>                    <mailto:jbonofre@apache.org
>>
>>                    <ma...@apache.org>>
>>                    http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>                                    Talend - http://www.talend.com
>>                    <http://www.talend.com/>
>>
>>
>>
>>
>>
>>
>>
>>
>>        --
>>        Jean-Baptiste Onofré
>>        jbonofre@apache.org <ma...@apache.org>
>>
>>        http://blog.nanthrax.net
>>        Talend - http://www.talend.com
>>
>>
>>
>>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Michael,

sorry I didn't see your latest message.

Let me try a test case on my box.

Regards
JB

On 01/19/2012 01:12 PM, Michael Täschner wrote:
> Hi JB,
>
> have you read my previous response? Using the "create-kar" of
> feature-maven-plugin of karaf 2.2.x as you described above, adds the
> feature.xml twice to the resulting kar file. As a result two feature
> repositories are registered in karaf.
>
> Right now karaf-maven-plugin 3.0.0-SNAPSHOT seems to be broken so I
> tried again with the feature-maven-plugin, but the problem persists.
>
> Do you have an idea how to prevent this duplication ?
>
> Thanks and Regards,
> Michael
>
> Am 13. Januar 2012 11:18 schrieb Michael Täschner
> <m.taeschner@googlemail.com <ma...@googlemail.com>>:
>
>     Hi JB,
>
>     yes I also got the create-kar goal of feature-maven-plugin of karaf
>     2.2.x working as you describe above. As a result though the
>     feature.xml is added twice to the resulting kar file, once in root
>     folder (because of being available in target/classes) and secondly
>     within the /repository path because it is defined as feature
>     description within the feature.xml. As a result on deployment the
>     feature url/repository is added twice to the karaf container which
>     was my original question.
>
>     Thanks and Regards,
>     Michael
>
>
>     2012/1/12 Jean-Baptiste Onofré <jb@nanthrax.net
>     <ma...@nanthrax.net>>
>
>         Hi Michael,
>
>         Using features-maven-plugin 2.2.5, you have to do something like
>
>         1. The define a filtered-resources folder in the resources
>         containing the features.xml file:
>
>         <build>
>         <resources>
>         <resource>
>         <directory>src/main/filtered-__resources</directory>
>         <filtered>true</filtered>
>         </resource>
>         </resources>
>         [...]
>
>         2. As the packaging is pom (<packaging>pom</packaging>), we need
>         to execute the dependency plugin "explicitly":
>
>         <plugins>
>         <plugin>
>         <groupId>org.apache.maven.__plugins</groupId>
>         <artifactId>maven-resources-__plugin</artifactId>
>         <executions>
>         <execution>
>         <id>filter</id>
>         <phase>generate-resources</__phase>
>         <goals>
>         <goal>resources</goal>
>         </goals>
>         </execution>
>         </executions>
>         </plugin>
>
>         3. Now you can define the featuresFile in the create-kar goal on
>         the process-resources phase:
>
>         <plugin>
>         <groupId>org.apache.karaf.__tooling</groupId>
>         <artifactId>features-maven-__plugin</artifactId>
>         <version>2.2.5</version>
>         <executions>
>         <execution>
>         <id>create-kar</id>
>         <phase>process-resources</__phase>
>         <goals>
>         <goal>create-kar</goal>
>         </goals>
>         <configuration>
>
>         <featuresFile>${basedir}/__target/classes/features.xml</__featuresFile>
>         </configuration>
>         </execution>
>         </executions>
>         </plugin>
>
>         Regards
>         JB
>
>
>         On 01/12/2012 02:12 PM, 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
>             <ma...@googlemail.com>
>             <mailto:m.taeschner@__googlemail.com
>             <ma...@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
>             <http://maven.apache.org/POM/4.0.0>"
>               xmlns:xsi="http://www.w3.org/__2001/XMLSchema-instance
>             <http://www.w3.org/2001/XMLSchema-instance>"
>               xsi:schemaLocation="http://__maven.apache.org/POM/4.0.0
>             <http://maven.apache.org/POM/4.0.0>
>             http://maven.apache.org/xsd/__maven-4.0.0.xsd
>             <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
>             <ma...@yahoo.com>
>             <mailto:david_jencks@yahoo.com
>             <ma...@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
>                 <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
>                 <ma...@yahoo.com>
>                 <mailto:david_jencks@yahoo.com
>                 <ma...@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 <ma...@nanthrax.net>
>                     <mailto:jb@nanthrax.net <ma...@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>
>
>                     <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/>
>
>                     <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 <ma...@apache.org>
>                     <mailto:jbonofre@apache.org
>                     <ma...@apache.org>>
>                     http://blog.nanthrax.net <http://blog.nanthrax.net/>
>                                     Talend - http://www.talend.com
>                     <http://www.talend.com/>
>
>
>
>
>
>
>
>
>         --
>         Jean-Baptiste Onofré
>         jbonofre@apache.org <ma...@apache.org>
>         http://blog.nanthrax.net
>         Talend - http://www.talend.com
>
>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Just FYI, I deployed a new 3.0.0-SNAPSHOT this morning which fix the 
issue with the karaf-maven-plugin.

Regards
JB

On 01/19/2012 01:12 PM, Michael Täschner wrote:
> Hi JB,
>
> have you read my previous response? Using the "create-kar" of
> feature-maven-plugin of karaf 2.2.x as you described above, adds the
> feature.xml twice to the resulting kar file. As a result two feature
> repositories are registered in karaf.
>
> Right now karaf-maven-plugin 3.0.0-SNAPSHOT seems to be broken so I
> tried again with the feature-maven-plugin, but the problem persists.
>
> Do you have an idea how to prevent this duplication ?
>
> Thanks and Regards,
> Michael
>
> Am 13. Januar 2012 11:18 schrieb Michael Täschner
> <m.taeschner@googlemail.com <ma...@googlemail.com>>:
>
>     Hi JB,
>
>     yes I also got the create-kar goal of feature-maven-plugin of karaf
>     2.2.x working as you describe above. As a result though the
>     feature.xml is added twice to the resulting kar file, once in root
>     folder (because of being available in target/classes) and secondly
>     within the /repository path because it is defined as feature
>     description within the feature.xml. As a result on deployment the
>     feature url/repository is added twice to the karaf container which
>     was my original question.
>
>     Thanks and Regards,
>     Michael
>
>
>     2012/1/12 Jean-Baptiste Onofré <jb@nanthrax.net
>     <ma...@nanthrax.net>>
>
>         Hi Michael,
>
>         Using features-maven-plugin 2.2.5, you have to do something like
>
>         1. The define a filtered-resources folder in the resources
>         containing the features.xml file:
>
>         <build>
>         <resources>
>         <resource>
>         <directory>src/main/filtered-__resources</directory>
>         <filtered>true</filtered>
>         </resource>
>         </resources>
>         [...]
>
>         2. As the packaging is pom (<packaging>pom</packaging>), we need
>         to execute the dependency plugin "explicitly":
>
>         <plugins>
>         <plugin>
>         <groupId>org.apache.maven.__plugins</groupId>
>         <artifactId>maven-resources-__plugin</artifactId>
>         <executions>
>         <execution>
>         <id>filter</id>
>         <phase>generate-resources</__phase>
>         <goals>
>         <goal>resources</goal>
>         </goals>
>         </execution>
>         </executions>
>         </plugin>
>
>         3. Now you can define the featuresFile in the create-kar goal on
>         the process-resources phase:
>
>         <plugin>
>         <groupId>org.apache.karaf.__tooling</groupId>
>         <artifactId>features-maven-__plugin</artifactId>
>         <version>2.2.5</version>
>         <executions>
>         <execution>
>         <id>create-kar</id>
>         <phase>process-resources</__phase>
>         <goals>
>         <goal>create-kar</goal>
>         </goals>
>         <configuration>
>
>         <featuresFile>${basedir}/__target/classes/features.xml</__featuresFile>
>         </configuration>
>         </execution>
>         </executions>
>         </plugin>
>
>         Regards
>         JB
>
>
>         On 01/12/2012 02:12 PM, 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
>             <ma...@googlemail.com>
>             <mailto:m.taeschner@__googlemail.com
>             <ma...@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
>             <http://maven.apache.org/POM/4.0.0>"
>               xmlns:xsi="http://www.w3.org/__2001/XMLSchema-instance
>             <http://www.w3.org/2001/XMLSchema-instance>"
>               xsi:schemaLocation="http://__maven.apache.org/POM/4.0.0
>             <http://maven.apache.org/POM/4.0.0>
>             http://maven.apache.org/xsd/__maven-4.0.0.xsd
>             <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
>             <ma...@yahoo.com>
>             <mailto:david_jencks@yahoo.com
>             <ma...@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
>                 <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
>                 <ma...@yahoo.com>
>                 <mailto:david_jencks@yahoo.com
>                 <ma...@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 <ma...@nanthrax.net>
>                     <mailto:jb@nanthrax.net <ma...@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>
>
>                     <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/>
>
>                     <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 <ma...@apache.org>
>                     <mailto:jbonofre@apache.org
>                     <ma...@apache.org>>
>                     http://blog.nanthrax.net <http://blog.nanthrax.net/>
>                                     Talend - http://www.talend.com
>                     <http://www.talend.com/>
>
>
>
>
>
>
>
>
>         --
>         Jean-Baptiste Onofré
>         jbonofre@apache.org <ma...@apache.org>
>         http://blog.nanthrax.net
>         Talend - http://www.talend.com
>
>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Just FYI, I deployed a new 3.0.0-SNAPSHOT this morning which fix the 
issue with the karaf-maven-plugin.

Regards
JB

On 01/19/2012 01:12 PM, Michael Täschner wrote:
> Hi JB,
>
> have you read my previous response? Using the "create-kar" of
> feature-maven-plugin of karaf 2.2.x as you described above, adds the
> feature.xml twice to the resulting kar file. As a result two feature
> repositories are registered in karaf.
>
> Right now karaf-maven-plugin 3.0.0-SNAPSHOT seems to be broken so I
> tried again with the feature-maven-plugin, but the problem persists.
>
> Do you have an idea how to prevent this duplication ?
>
> Thanks and Regards,
> Michael
>
> Am 13. Januar 2012 11:18 schrieb Michael Täschner
> <m.taeschner@googlemail.com <ma...@googlemail.com>>:
>
>     Hi JB,
>
>     yes I also got the create-kar goal of feature-maven-plugin of karaf
>     2.2.x working as you describe above. As a result though the
>     feature.xml is added twice to the resulting kar file, once in root
>     folder (because of being available in target/classes) and secondly
>     within the /repository path because it is defined as feature
>     description within the feature.xml. As a result on deployment the
>     feature url/repository is added twice to the karaf container which
>     was my original question.
>
>     Thanks and Regards,
>     Michael
>
>
>     2012/1/12 Jean-Baptiste Onofré <jb@nanthrax.net
>     <ma...@nanthrax.net>>
>
>         Hi Michael,
>
>         Using features-maven-plugin 2.2.5, you have to do something like
>
>         1. The define a filtered-resources folder in the resources
>         containing the features.xml file:
>
>         <build>
>         <resources>
>         <resource>
>         <directory>src/main/filtered-__resources</directory>
>         <filtered>true</filtered>
>         </resource>
>         </resources>
>         [...]
>
>         2. As the packaging is pom (<packaging>pom</packaging>), we need
>         to execute the dependency plugin "explicitly":
>
>         <plugins>
>         <plugin>
>         <groupId>org.apache.maven.__plugins</groupId>
>         <artifactId>maven-resources-__plugin</artifactId>
>         <executions>
>         <execution>
>         <id>filter</id>
>         <phase>generate-resources</__phase>
>         <goals>
>         <goal>resources</goal>
>         </goals>
>         </execution>
>         </executions>
>         </plugin>
>
>         3. Now you can define the featuresFile in the create-kar goal on
>         the process-resources phase:
>
>         <plugin>
>         <groupId>org.apache.karaf.__tooling</groupId>
>         <artifactId>features-maven-__plugin</artifactId>
>         <version>2.2.5</version>
>         <executions>
>         <execution>
>         <id>create-kar</id>
>         <phase>process-resources</__phase>
>         <goals>
>         <goal>create-kar</goal>
>         </goals>
>         <configuration>
>
>         <featuresFile>${basedir}/__target/classes/features.xml</__featuresFile>
>         </configuration>
>         </execution>
>         </executions>
>         </plugin>
>
>         Regards
>         JB
>
>
>         On 01/12/2012 02:12 PM, 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
>             <ma...@googlemail.com>
>             <mailto:m.taeschner@__googlemail.com
>             <ma...@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
>             <http://maven.apache.org/POM/4.0.0>"
>               xmlns:xsi="http://www.w3.org/__2001/XMLSchema-instance
>             <http://www.w3.org/2001/XMLSchema-instance>"
>               xsi:schemaLocation="http://__maven.apache.org/POM/4.0.0
>             <http://maven.apache.org/POM/4.0.0>
>             http://maven.apache.org/xsd/__maven-4.0.0.xsd
>             <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
>             <ma...@yahoo.com>
>             <mailto:david_jencks@yahoo.com
>             <ma...@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
>                 <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
>                 <ma...@yahoo.com>
>                 <mailto:david_jencks@yahoo.com
>                 <ma...@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 <ma...@nanthrax.net>
>                     <mailto:jb@nanthrax.net <ma...@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>
>
>                     <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/>
>
>                     <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 <ma...@apache.org>
>                     <mailto:jbonofre@apache.org
>                     <ma...@apache.org>>
>                     http://blog.nanthrax.net <http://blog.nanthrax.net/>
>                                     Talend - http://www.talend.com
>                     <http://www.talend.com/>
>
>
>
>
>
>
>
>
>         --
>         Jean-Baptiste Onofré
>         jbonofre@apache.org <ma...@apache.org>
>         http://blog.nanthrax.net
>         Talend - http://www.talend.com
>
>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Michael Täschner <m....@googlemail.com>.
Hi JB,

have you read my previous response? Using the "create-kar" of
feature-maven-plugin of karaf 2.2.x as you described above, adds the
feature.xml twice to the resulting kar file. As a result two feature
repositories are registered in karaf.

Right now karaf-maven-plugin 3.0.0-SNAPSHOT seems to be broken so I tried
again with the feature-maven-plugin, but the problem persists.

Do you have an idea how to prevent this duplication ?

Thanks and Regards,
Michael

Am 13. Januar 2012 11:18 schrieb Michael Täschner <
m.taeschner@googlemail.com>:

> Hi JB,
>
> yes I also got the create-kar goal of feature-maven-plugin of karaf 2.2.x
> working as you describe above. As a result though the feature.xml is added
> twice to the resulting kar file, once in root folder (because of being
> available in target/classes) and secondly within the /repository path
> because it is defined as feature description within the feature.xml. As a
> result on deployment the feature url/repository is added twice to the karaf
> container which was my original question.
>
> Thanks and Regards,
> Michael
>
>
> 2012/1/12 Jean-Baptiste Onofré <jb...@nanthrax.net>
>
>> Hi Michael,
>>
>> Using features-maven-plugin 2.2.5, you have to do something like
>>
>> 1. The define a filtered-resources folder in the resources containing the
>> features.xml file:
>>
>> <build>
>>  <resources>
>>    <resource>
>>      <directory>src/main/filtered-**resources</directory>
>>      <filtered>true</filtered>
>>    </resource>
>>  </resources>
>> [...]
>>
>> 2. As the packaging is pom (<packaging>pom</packaging>), we need to
>> execute the dependency plugin "explicitly":
>>
>> <plugins>
>>  <plugin>
>>    <groupId>org.apache.maven.**plugins</groupId>
>>    <artifactId>maven-resources-**plugin</artifactId>
>>    <executions>
>>      <execution>
>>        <id>filter</id>
>>        <phase>generate-resources</**phase>
>>        <goals>
>>          <goal>resources</goal>
>>        </goals>
>>      </execution>
>>    </executions>
>>  </plugin>
>>
>> 3. Now you can define the featuresFile in the create-kar goal on the
>> process-resources phase:
>>
>>  <plugin>
>>    <groupId>org.apache.karaf.**tooling</groupId>
>>    <artifactId>features-maven-**plugin</artifactId>
>>    <version>2.2.5</version>
>>    <executions>
>>      <execution>
>>        <id>create-kar</id>
>>        <phase>process-resources</**phase>
>>        <goals>
>>          <goal>create-kar</goal>
>>        </goals>
>>        <configuration>
>>
>> <featuresFile>${basedir}/**target/classes/features.xml</**featuresFile>
>>        </configuration>
>>      </execution>
>>    </executions>
>>  </plugin>
>>
>> Regards
>> JB
>>
>>
>> On 01/12/2012 02:12 PM, 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 <ma...@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<http://maven.apache.org/POM/4.0.0>"
>>>  xmlns:xsi="http://www.w3.org/**2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>"
>>>  xsi:schemaLocation="http://**maven.apache.org/POM/4.0.0<http://maven.apache.org/POM/4.0.0>
>>> http://maven.apache.org/xsd/**maven-4.0.0.xsd<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
>>>    <mailto: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<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
>>>>        <mailto: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
>>>>>            <ma...@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>
>>>>>
>>>>>                <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/>
>>>>>
>>>>>                <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 <ma...@apache.org>
>>>>>                http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>                Talend - http://www.talend.com <http://www.talend.com/>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>>
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
>
>

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Michael Täschner <m....@googlemail.com>.
Hi JB,

yes I also got the create-kar goal of feature-maven-plugin of karaf 2.2.x
working as you describe above. As a result though the feature.xml is added
twice to the resulting kar file, once in root folder (because of being
available in target/classes) and secondly within the /repository path
because it is defined as feature description within the feature.xml. As a
result on deployment the feature url/repository is added twice to the karaf
container which was my original question.

Thanks and Regards,
Michael

2012/1/12 Jean-Baptiste Onofré <jb...@nanthrax.net>

> Hi Michael,
>
> Using features-maven-plugin 2.2.5, you have to do something like
>
> 1. The define a filtered-resources folder in the resources containing the
> features.xml file:
>
> <build>
>  <resources>
>    <resource>
>      <directory>src/main/filtered-**resources</directory>
>      <filtered>true</filtered>
>    </resource>
>  </resources>
> [...]
>
> 2. As the packaging is pom (<packaging>pom</packaging>), we need to
> execute the dependency plugin "explicitly":
>
> <plugins>
>  <plugin>
>    <groupId>org.apache.maven.**plugins</groupId>
>    <artifactId>maven-resources-**plugin</artifactId>
>    <executions>
>      <execution>
>        <id>filter</id>
>        <phase>generate-resources</**phase>
>        <goals>
>          <goal>resources</goal>
>        </goals>
>      </execution>
>    </executions>
>  </plugin>
>
> 3. Now you can define the featuresFile in the create-kar goal on the
> process-resources phase:
>
>  <plugin>
>    <groupId>org.apache.karaf.**tooling</groupId>
>    <artifactId>features-maven-**plugin</artifactId>
>    <version>2.2.5</version>
>    <executions>
>      <execution>
>        <id>create-kar</id>
>        <phase>process-resources</**phase>
>        <goals>
>          <goal>create-kar</goal>
>        </goals>
>        <configuration>
>
> <featuresFile>${basedir}/**target/classes/features.xml</**featuresFile>
>        </configuration>
>      </execution>
>    </executions>
>  </plugin>
>
> Regards
> JB
>
>
> On 01/12/2012 02:12 PM, 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 <ma...@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<http://maven.apache.org/POM/4.0.0>"
>>  xmlns:xsi="http://www.w3.org/**2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>"
>>  xsi:schemaLocation="http://**maven.apache.org/POM/4.0.0<http://maven.apache.org/POM/4.0.0>
>> http://maven.apache.org/xsd/**maven-4.0.0.xsd<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
>>    <mailto: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<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
>>>        <mailto: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
>>>>            <ma...@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>
>>>>
>>>>                <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/>
>>>>
>>>>                <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 <ma...@apache.org>
>>>>                http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>                Talend - http://www.talend.com <http://www.talend.com/>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Michael,

Using features-maven-plugin 2.2.5, you have to do something like

1. The define a filtered-resources folder in the resources containing 
the features.xml file:

<build>
   <resources>
     <resource>
       <directory>src/main/filtered-resources</directory>
       <filtered>true</filtered>
     </resource>
   </resources>
[...]

2. As the packaging is pom (<packaging>pom</packaging>), we need to 
execute the dependency plugin "explicitly":

<plugins>
   <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-resources-plugin</artifactId>
     <executions>
       <execution>
         <id>filter</id>
         <phase>generate-resources</phase>
         <goals>
           <goal>resources</goal>
         </goals>
       </execution>
     </executions>
   </plugin>

3. Now you can define the featuresFile in the create-kar goal on the 
process-resources phase:

   <plugin>
     <groupId>org.apache.karaf.tooling</groupId>
     <artifactId>features-maven-plugin</artifactId>
     <version>2.2.5</version>
     <executions>
       <execution>
         <id>create-kar</id>
         <phase>process-resources</phase>
         <goals>
           <goal>create-kar</goal>
         </goals>
         <configuration>
 
<featuresFile>${basedir}/target/classes/features.xml</featuresFile>
         </configuration>
       </execution>
     </executions>
   </plugin>

Regards
JB

On 01/12/2012 02:12 PM, 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 <ma...@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
>     <ma...@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
>>         <ma...@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
>>>             <ma...@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 <ma...@apache.org>
>>>                 http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>                 Talend - http://www.talend.com <http://www.talend.com/>
>>>
>>>
>>
>>
>
>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Michael Täschner <m....@googlemail.com>.
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 <da...@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 <da...@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 <da...@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
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>
>

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by David Jencks <da...@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....@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 <da...@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 <da...@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
>>> 
>>> I blogged about it:
>>> 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
>>> 
>> 
>> 
> 
> 
> 


Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Michael Täschner <m....@googlemail.com>.
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 <da...@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 <da...@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
>>>>
>>>
>>>
>>>
>>
>>
>

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Michael Täschner <m....@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 <da...@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 <da...@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
>>>
>>
>>
>>
>
>

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by David Jencks <da...@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 <da...@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
>> 
>> I blogged about it:
>> 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
>> 
> 
> 


Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Michael Täschner <m....@googlemail.com>.
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 <da...@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
>>
>
>
>

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by David Jencks <da...@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
> 
> I blogged about it:
> 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
> 


Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by Michael Täschner <m....@googlemail.com>.
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
>

Re: Duplicate feature repository entry using archive-kar to build deployable applications

Posted by 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

I blogged about it:
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