Hi Benjamin,

I checked in the code (on the 2.3.x branch), and the featuresFile attribute is used, for instance:

[...]
RepositoryImpl featuresRepo = new RepositoryImpl(featuresFile.toURI());
[...]
jarArchiver.addFile(featuresFile, repositoryPath + layout.pathOf(featureArtifact));

I just made a try with the following pom.xml:

<?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>net.nanthrax</groupId>
  <artifactId>test-features</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.karaf.tooling</groupId>
        <artifactId>features-maven-plugin</artifactId>
        <version>2.3.0</version>
        <executions>
          <execution>
            <id>create-kar</id>
            <goals>
              <goal>create-kar</goal>
            </goals>
            <configuration>
              <featuresFile>/tmp/features.xml</featuresFile>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

and the plugin use my features.xml from the tmp folder.

Could you share you pom.xml ?

Regards
JB

On 11/21/2012 04:36 PM, Benjamin Debeerst wrote:
Hi all,

I've been setting up a pom to create a kar-file for distribution. I found JB's 
blog post very helpful:
http://blog.nanthrax.net/2011/12/do-you-know-the-apache-karaf-maven-plugins/

I recognized it's very old and updated the plugin version to 2.3.0 (release). 
You find my pom at the end of the email.

The maven execution mvn features:create-kar fails with the following message:

[ERROR] Failed to execute goal 
org.apache.karaf.tooling:features-maven-plugin:2.3.0:create-kar (default-cli) 
on project test-features: Could not interpret features
XML file: D:\temp\test-kar\target\feature\feature.xml (Das System kann den 
angegebenen Pfad nicht finden) : 
file:/D:/temp/test-kar/target/feature/feature.xml

It does not find the feature xml. But it looks at the wrong place. 
D:\temp\test-kar\ is the project folder. The feature xml is thus in 
D:\temp\test-kar\src\main\resources, as defined in the pom.

When I run mvn with the -X switch, I see this:
[DEBUG] Configuring mojo 
org.apache.karaf.tooling:features-maven-plugin:2.3.0:create-kar from plugin realm 
ClassRealm[plugin>org.apache.karaf.tooling:features-maven-plugin:2.3.0, parent: 
sun.misc.Launcher$AppClassLoader@35ce36]
[DEBUG] Configuring mojo 
'org.apache.karaf.tooling:features-maven-plugin:2.3.0:create-kar' with basic 
configurator -->
[DEBUG]   (f) featureArtifactType = xml
[DEBUG]   (f) featuresFile = D:\temp\test-kar\target\feature\feature.xml
[DEBUG]   (f) finalName = test-features-1.0.0-SNAPSHOT

Obviously the configuration is not used. Am I missing something? Or is this a 
known issue?

Best,
Benjamin




<?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>com.example</groupId>
   <artifactId>test-features</artifactId>
   <version>1.0.0-SNAPSHOT</version>
   <packaging>pom</packaging>

   <build>
     <plugins>
       <plugin>
         <groupId>org.apache.karaf.tooling</groupId>
         <artifactId>features-maven-plugin</artifactId>
         <version>2.3.0</version>
         <executions>
           <execution>
             <id>create-kar</id>
             <goals>
               <goal>create-kar</goal>
             </goals>
             <configuration>
               
<featuresFile>${project.basedir}\src\main\resources\features.xml</featuresFile>
             </configuration>
           </execution>
         </executions>
       </plugin>
     </plugins>
   </build>
</project>


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

Reply via email to