You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Benjamin Debeerst <Be...@gmx.de> on 2012/11/21 16:36:44 UTC

features-maven-plugin ignores configuration?

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>

Re: features-maven-plugin ignores configuration?

Posted by Benjamin Debeerst <Be...@gmx.de>.
Hi JB,

I tried your features.xml without any change. And yes i tried both absolute and relative paths, both on my windows machine and the unix system without any luck.

I did find an automated workaround though, using the maven resources plugin and configuring it to copy the file to the target/features/ directory prior to packaging - this works. But I find that more a hacked workaround than a real solution.

For anyone interested, maybe facing a similar problem: Put your feaures into one single file named feature.xml and configure the resources-plugin to copy it to the target folder upon packaging like this:

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
  <execution>
	<id>copy-resources</id>
	<phase>process-resources</phase>
	<goals>
	  <goal>copy-resources</goal>
	</goals>
	<configuration>
	  <outputDirectory>${project.basedir}/target/feature</outputDirectory>
	  <resources>          
		<resource>
		  <directory>${project.basedir}/src/main/resources</directory>
		  <includes>
		    <include>feature.xml</include>
		  </includes>
		</resource>
	  </resources>              
	</configuration>            
  </execution>
</executions>
</plugin>

That does the job, although it forces you to use only one single features file. But that's a minor thing.

Thanks for your effort JB!
Regards,
Benjamin

-------- Original-Nachricht --------
> Datum: Fri, 23 Nov 2012 08:59:05 +0100
> Von: "Jean-Baptiste Onofré" <jb...@nanthrax.net>
> An: user@karaf.apache.org
> Betreff: Re: features-maven-plugin ignores configuration?

> Hi Benjamin,
> 
> did you try putting a valid absolute path (like c:\path\to\features.xml) ?
> 
> I don't understand as it works for me.
> 
> Regards
> JB
> 
> On 11/22/2012 10:59 PM, Benjamin Debeerst wrote:
> > Hi JB,
> >
> > thanks again. I did post the features-xml just for completeness but I
> > don't think the contents really matter. The plugin does complain about
> > not finding the feature.xml in the first place, not about it's contents.
> > And when I put the file to target/feature/feature.xml everything works.
> > I'll try your suggestion tommorow anyways though.
> >
> > Regards,
> > Benjamin
> >
> >
> > -------- Original-Nachricht --------
> >> Datum: Thu, 22 Nov 2012 21:59:37 +0100
> >> Von: "Jean-Baptiste Onofré" <jb...@nanthrax.net>
> >> An: user@karaf.apache.org
> >> Betreff: Re: features-maven-plugin ignores configuration?
> >
> >> Hi Benjamin,
> >>
> >> could you try to add a name on the features tag:
> >>
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <features name="my-features">
> >>        <feature name="test-app" version="1.0.0">
> >>            <bundle>mvn:joda-time/joda-time/2.1</bundle>
> >>        </feature>
> >> </features>
> >>
> >> Anyway, I will try with your features.xml tomorrow morning.
> >>
> >> I keep you posted.
> >>
> >> Regards
> >> JB
> >>
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Re: features-maven-plugin ignores configuration?

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

did you try putting a valid absolute path (like c:\path\to\features.xml) ?

I don't understand as it works for me.

Regards
JB

On 11/22/2012 10:59 PM, Benjamin Debeerst wrote:
> Hi JB,
>
> thanks again. I did post the features-xml just for completeness but I
> don't think the contents really matter. The plugin does complain about
> not finding the feature.xml in the first place, not about it's contents.
> And when I put the file to target/feature/feature.xml everything works.
> I'll try your suggestion tommorow anyways though.
>
> Regards,
> Benjamin
>
>
> -------- Original-Nachricht --------
>> Datum: Thu, 22 Nov 2012 21:59:37 +0100
>> Von: "Jean-Baptiste Onofré" <jb...@nanthrax.net>
>> An: user@karaf.apache.org
>> Betreff: Re: features-maven-plugin ignores configuration?
>
>> Hi Benjamin,
>>
>> could you try to add a name on the features tag:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <features name="my-features">
>>        <feature name="test-app" version="1.0.0">
>>            <bundle>mvn:joda-time/joda-time/2.1</bundle>
>>        </feature>
>> </features>
>>
>> Anyway, I will try with your features.xml tomorrow morning.
>>
>> I keep you posted.
>>
>> Regards
>> JB
>>

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

Re: features-maven-plugin ignores configuration?

Posted by Benjamin Debeerst <Be...@gmx.de>.
Hi JB,

thanks again. I did post the features-xml just for completeness but I
don't think the contents really matter. The plugin does complain about
not finding the feature.xml in the first place, not about it's contents.
And when I put the file to target/feature/feature.xml everything works.
I'll try your suggestion tommorow anyways though.

Regards,
Benjamin


-------- Original-Nachricht --------
> Datum: Thu, 22 Nov 2012 21:59:37 +0100
> Von: "Jean-Baptiste Onofré" <jb...@nanthrax.net>
> An: user@karaf.apache.org
> Betreff: Re: features-maven-plugin ignores configuration?

> Hi Benjamin,
> 
> could you try to add a name on the features tag:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <features name="my-features">
>       <feature name="test-app" version="1.0.0">
>           <bundle>mvn:joda-time/joda-time/2.1</bundle>
>       </feature>
> </features>
> 
> Anyway, I will try with your features.xml tomorrow morning.
> 
> I keep you posted.
> 
> Regards
> JB
> 

Re: features-maven-plugin ignores configuration?

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

could you try to add a name on the features tag:

<?xml version="1.0" encoding="UTF-8"?>
<features name="my-features">
      <feature name="test-app" version="1.0.0">
          <bundle>mvn:joda-time/joda-time/2.1</bundle>
      </feature>
</features>

Anyway, I will try with your features.xml tomorrow morning.

I keep you posted.

Regards
JB

On 11/22/2012 10:39 AM, Benjamin Debeerst wrote:
> Thanks JB,
>
> I've tried your pom (copy-paste-execute), but without success - the same error occures. Both on my windows (XP) machine and on a debian system I had no luck (first I was suspecting some IO trouble on the windows machine, thats why I gave the debian system a try).
>
> [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: /home/debeerstb/temp/test-kar/target/feature/feature.xml (No such file or directory) : file:/home/debeerstb/temp/test-kar/target/feature/feature.xml -> [Help 1]
>
> (Of course on the Windows system I didn't try the absolute path /tmp/fatures.xml but other absolute or relative paths)
>
> The plugin always looks for the features file in taget/feature/feature.xml. When I put the features file there on beforehand, the build works. But that's not really what I wanna do.
>
> I'm running on maven 3.0.4 btw.
>
> I put my own pom and features.xml below for completeness, but since I used your exact pom this time I don't think that will help.
>
> Regards,
> 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>
>
>
> and the features.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <features>
>      <feature name="test-app" version="12.11.02-2">
>          <bundle start-level="50">mvn:joda-time/joda-time/2.1</bundle>
>      </feature>
> </features>
>
>
> -------- Original-Nachricht --------
>> Datum: Wed, 21 Nov 2012 17:28:42 +0100
>> Von: "Jean-Baptiste Onofré" <jb...@nanthrax.net>
>> An: user@karaf.apache.org
>> Betreff: Re: features-maven-plugin ignores configuration?
>
>> 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é
>> 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: features-maven-plugin ignores configuration?

Posted by Benjamin Debeerst <Be...@gmx.de>.
Hi James,

I follow you on this - I do write the feature.xml myself. But I would like to build the karaf-archive as distributable artifact for a system that has no access to a repository. As far as I know, the feature plugin is the only way to achive that at the moment.

Best,
Benjamin

-------- Original-Nachricht --------
> Datum: Thu, 22 Nov 2012 09:41:42 -0500
> Von: James Carman <ja...@carmanconsulting.com>
> An: user@karaf.apache.org
> Betreff: Re: features-maven-plugin ignores configuration?

> In all honesty, I've had much better luck hand-crafting my
> features.xml files.  Then, you don't have to worry about marking
> dependencies as "provided" and what not to get it looking exactly like
> you want it.  We tried using the plugin for the longest time because
> it just seemed easier, but after we finally switched to manual, I'll
> never go back!  That's my $0.02.
> 

Re: features-maven-plugin ignores configuration?

Posted by James Carman <ja...@carmanconsulting.com>.
In all honesty, I've had much better luck hand-crafting my
features.xml files.  Then, you don't have to worry about marking
dependencies as "provided" and what not to get it looking exactly like
you want it.  We tried using the plugin for the longest time because
it just seemed easier, but after we finally switched to manual, I'll
never go back!  That's my $0.02.

On Thu, Nov 22, 2012 at 4:39 AM, Benjamin Debeerst
<Be...@gmx.de> wrote:
> Thanks JB,
>
> I've tried your pom (copy-paste-execute), but without success - the same error occures. Both on my windows (XP) machine and on a debian system I had no luck (first I was suspecting some IO trouble on the windows machine, thats why I gave the debian system a try).
>
> [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: /home/debeerstb/temp/test-kar/target/feature/feature.xml (No such file or directory) : file:/home/debeerstb/temp/test-kar/target/feature/feature.xml -> [Help 1]
>
> (Of course on the Windows system I didn't try the absolute path /tmp/fatures.xml but other absolute or relative paths)
>
> The plugin always looks for the features file in taget/feature/feature.xml. When I put the features file there on beforehand, the build works. But that's not really what I wanna do.
>
> I'm running on maven 3.0.4 btw.
>
> I put my own pom and features.xml below for completeness, but since I used your exact pom this time I don't think that will help.
>
> Regards,
> 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>
>
>
> and the features.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <features>
>     <feature name="test-app" version="12.11.02-2">
>         <bundle start-level="50">mvn:joda-time/joda-time/2.1</bundle>
>     </feature>
> </features>
>
>
> -------- Original-Nachricht --------
>> Datum: Wed, 21 Nov 2012 17:28:42 +0100
>> Von: "Jean-Baptiste Onofré" <jb...@nanthrax.net>
>> An: user@karaf.apache.org
>> Betreff: Re: features-maven-plugin ignores configuration?
>
>> 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é
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com

Re: features-maven-plugin ignores configuration?

Posted by Benjamin Debeerst <Be...@gmx.de>.
Thanks JB,

I've tried your pom (copy-paste-execute), but without success - the same error occures. Both on my windows (XP) machine and on a debian system I had no luck (first I was suspecting some IO trouble on the windows machine, thats why I gave the debian system a try).

[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: /home/debeerstb/temp/test-kar/target/feature/feature.xml (No such file or directory) : file:/home/debeerstb/temp/test-kar/target/feature/feature.xml -> [Help 1]

(Of course on the Windows system I didn't try the absolute path /tmp/fatures.xml but other absolute or relative paths)

The plugin always looks for the features file in taget/feature/feature.xml. When I put the features file there on beforehand, the build works. But that's not really what I wanna do.

I'm running on maven 3.0.4 btw.

I put my own pom and features.xml below for completeness, but since I used your exact pom this time I don't think that will help.

Regards,
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>


and the features.xml:

<?xml version="1.0" encoding="UTF-8"?>
<features>
    <feature name="test-app" version="12.11.02-2">
        <bundle start-level="50">mvn:joda-time/joda-time/2.1</bundle>
    </feature>
</features>


-------- Original-Nachricht --------
> Datum: Wed, 21 Nov 2012 17:28:42 +0100
> Von: "Jean-Baptiste Onofré" <jb...@nanthrax.net>
> An: user@karaf.apache.org
> Betreff: Re: features-maven-plugin ignores configuration?

> 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é
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Re: features-maven-plugin ignores configuration?

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
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é
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com