Hi,

I have not been able to get generate-features-xml to work a very simple
example, and I didn't find any luck on Google/Bing/this forum for a solution
(exception this one,
http://mail-archives.apache.org/mod_mbox/felix-users/201011.mbox/%3CAANLkTinOoV6brGc7ahpxBJRQ1L96+kFD8XKN-bgAJ+=w...@mail.gmail.com%3E,
which does not provide a solution.)

Here is my simple test:

...
    <dependencies>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.5.8</version>
    </dependency>
    </dependencies>

    <build>
    <plugins>
      <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-dependency-plugin</artifactId>
           <executions>
             <execution>
               <id>copy-dependencies</id>
               <phase>package</phase>
               <goals>
                 <goal>copy-dependencies</goal>
               </goals>
               <configuration>
                
<outputDirectory>${project.build.directory}/bundles</outputDirectory>
                 <overWriteReleases>false</overWriteReleases>
                 <overWriteSnapshots>false</overWriteSnapshots>
                 <overWriteIfNewer>true</overWriteIfNewer>
               </configuration>
             </execution>
       </executions>
     </plugin>
     <plugin>
        <groupId>org.apache.karaf.tooling</groupId>
        <artifactId>features-maven-plugin</artifactId>
        <version>2.2.0</version>
          <executions>
            <execution>
              <id>generate</id>
              <phase>package</phase>
              <goals>
                <goal>generate-features-xml</goal>
              </goals>
              <configuration>
              
                <bundles>bundles.properties</bundles>
               
<outputFile>${project.build.directory}/features.xml</outputFile>
              </configuration>
            </execution>
          </executions>
        </plugin>
    </plugins>

Here is the error:
[INFO] Step 1: Building list of provided bundle exports
[ERROR] 
java.lang.NullPointerException
        at
org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.injectSession(DefaultLegacyArtifactCollector.java:77)
        at
org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.collect(DefaultLegacyArtifactCollector.java:99)
        at
org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.collect(DefaultLegacyArtifactCollector.java:782)
        at
org.apache.maven.shared.dependency.tree.DefaultDependencyTreeBuilder.buildDependencyTree(DefaultDependencyTreeBuilder.java:97)
        at
org.apache.karaf.tooling.features.GenerateFeaturesXmlMojo.readKernelBundles(GenerateFeaturesXmlMojo.java:190)
        at
org.apache.karaf.tooling.features.GenerateFeaturesXmlMojo.execute(GenerateFeaturesXmlMojo.java:147)
        at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 14.524s
[INFO] Finished at: Mon Apr 18 23:47:32 PDT 2011
[INFO] Final Memory: 8M/81M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.karaf.tooling:features-maven-plugin:2.2.0:generate-features-xml
(generate) on project karaf-test: Unable to create features.xml file:
java.lang.NullPointerException -> [Help 1]


Without the maven dependency plugin, target directory is not even created,
and I got the following error:


[INFO] --- features-maven-plugin:2.2.0:generate-features-xml (generate) @
karaf-test ---
[ERROR] 
java.io.FileNotFoundException:
/Users/triet.kha/Documents/sandbox/workspace/repo/p2p_registrar/service/p2pregistrar-test/target/features.xml
(No such file or directory)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
        at
org.apache.karaf.tooling.features.GenerateFeaturesXmlMojo.execute(GenerateFeaturesXmlMojo.java:145)
        at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1.318s
[INFO] Finished at: Mon Apr 18 23:48:32 PDT 2011
[INFO] Final Memory: 4M/81M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.karaf.tooling:features-maven-plugin:2.2.0:generate-features-xml
(generate) on project karaf-test: Unable to create features.xml file:
java.io.FileNotFoundException:
/Users/triet.kha/Documents/sandbox/workspace/repo/p2p_registrar/service/p2pregistrar-test/target/features.xml
(No such file or directory) -> [Help 1]
[ERROR] 

The example provided at
http://karaf.apache.org/manual/2.1.99-SNAPSHOT/developers-guide/features-maven-plugin-generate.html
does not work either.  There seems to be a typo with the goal.


Can someone please help pointing out what I did wrong?  No body seem to have
this problem, so I must have a stupid error somewhere, but I really run out
of resources.  Your help is greatly appreciated.

Regards,

- Triet

--
View this message in context: 
http://karaf.922171.n3.nabble.com/Can-t-make-features-maven-plugin-generate-features-xml-to-work-tp2837746p2837746.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to