Hi guys,

The purpose of the kar goal is to take a features descriptor and package the features descriptor and the related bundle into a kar archive (that's it's a goal of the features maven plugin).
The kar deployer create a repo for these bundles.
I raised KARAF-459 about that. At least, the kar goals should take an argument to define if the bundle are embedded in the kar or not. But, if the kar doesn't embed the bundle, what's the advantage of using a kar more than directly drop the features descriptor into the deploy directory :)

Regards
JB

On 03/01/2011 11:40 PM, David Jencks wrote:
I couldn't quite understand what the docs expected.  What I think is usable is 
the (undocumented) kar packaging which ought to look something like this:

<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>hibernate-osgi</groupId>
  <artifactId>hibernate-osgi</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>kar</packaging>
  <name>hibernate-osgi</name>

<dependencies>
<!-- put in the bundles you want in the features.xml and kar as dependencies -->
</dependencies>

  <build>
        <plugins>
                <plugin>
                        <groupId>org.apache.karaf.tooling</groupId>
                        <artifactId>features-maven-plugin</artifactId>
                        <version>2.99.99-SNAPSHOT</version>
                        <extensions>true</extensions>
                </plugin>
        </plugins>
  </build>

</project>

This should generate a features.xml file inside the kar and include the bundles 
you mentioned as entries in the feature.xml and copied into the kar.

thanks
david jencks

On Mar 1, 2011, at 2:15 PM, karafman wrote:

To test the KAR feature, I compiled the trunk and executed the following
pom.xml file:
<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>hibernate-osgi</groupId>
  <artifactId>hibernate-osgi</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>hibernate-osgi</name>

  <build>
        <plugins>
                <plugin>
                        <groupId>org.apache.karaf.tooling</groupId>
                        <artifactId>features-maven-plugin</artifactId>
                        <version>2.99.99-SNAPSHOT</version>
                        <executions>
                                <execution>
                                        <id>archive-kar</id>
                                        <goals>
                                                <goal>archive-kar</goal>
                                        </goals>
                                        <configuration>                         
                  
<featuresFile>src/main/resources/features.xml</featuresFile>
                                        </configuration>
                                </execution>
                        </executions>
                </plugin>
        </plugins>
  </build>

</project>

Using this features.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<features>
               <feature name="hibernate" version="3.3.2.GA">
        
<bundle>mvn:javax.xml.stream/com.springsource.javax.xml.stream/1.0.1</bundle>
                <bundle>mvn:org.dom4j/com.springsource.org.dom4j/1.6.1</bundle>
        
<bundle>mvn:org.jboss.javassist/com.springsource.javassist/3.9.0.GA</bundle>
        
<bundle>mvn:javax.persistence/com.springsource.javax.persistence/1.0.0</bundle>
                <bundle>mvn:org.antlr/com.springsource.antlr/2.7.7</bundle>
        
<bundle>mvn:net.sourceforge.cglib/com.springsource.net.sf.cglib/2.2.0</bundle>
        
<bundle>mvn:org.apache.commons/com.springsource.org.apache.commons.collections/3.2.1</bundle>
        
<bundle>mvn:org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1</bundle>
        
<bundle>mvn:org.objectweb.asm/com.springsource.org.objectweb.asm/1.5.3</bundle>
        
<bundle>mvn:org.objectweb.asm/com.springsource.org.objectweb.asm.attrs/1.5.3</bundle>
                
<bundle>mvn:org.hibernate/com.springsource.org.hibernate/3.3.2.GA</bundle>
        
<bundle>mvn:org.hibernate/com.springsource.org.hibernate.annotations/3.3.1.ga</bundle>
        
<bundle>mvn:org.hibernate/com.springsource.org.hibernate.annotations.common/3.3.0.ga</bundle>
        
<bundle>mvn:org.hibernate/com.springsource.org.hibernate.ejb/3.3.2.GA</bundle>
        </feature>
</features>

The .kar file created didn't contain any of the bundles, just the
features.xml file.  The expected behavior is to (according to
http://karaf.apache.org/manual/2.2.1-SNAPSHOT/users-guide/kar.html):
The kar-archive goal:
1. Reads all features specified in the features descriptor.
2. For each feature, it resolves the bundles defined in the feature.
3. All bundles are packaged into the kar archive.

So, it appears the KAR feature is not doing what is stated in the docs.  I
suggest we either change the documentation, or the archive-kar goal.

-----
Karafman
Slayer of the JEE
Pounder of the Perl Programmer

--
View this message in context: 
http://karaf.922171.n3.nabble.com/KAR-feature-not-doing-what-the-docs-say-it-should-tp2606973p2606973.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.


Reply via email to