Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-4011

karaf-maven-plugin:features-add-to-repository NPE with blueprint:file: URL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 4.0.2
    • 4.0.3
    • karaf
    • None

    Description

      When using the karaf-maven-plugin version 4.0.2-SNAPSHOT with the features-add-to-repository goal, I get an NPE when a feature has a protocol of blueprint:file:

      stackTrace
      [ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.2-SNAPSHOT:features-add-to-repository (features-add-to-repository) on project myproject: Execution features-add-to-repository of goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.2-SNAPSHOT:features-add-to-repository failed: Can't resolve artifact null: NullPointerException -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.2-SNAPSHOT:features-add-to-repository (features-add-to-repository) on project myproject: Execution features-add-to-repository of goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.2-SNAPSHOT:features-add-to-repository failed: Can't resolve artifact null
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
      	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:116)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
      	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
      	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
      	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
      Caused by: org.apache.maven.plugin.PluginExecutionException: Execution features-add-to-repository of goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.2-SNAPSHOT:features-add-to-repository failed: Can't resolve artifact null
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      	... 20 more
      Caused by: java.lang.RuntimeException: Can't resolve artifact null
      	at org.apache.karaf.tooling.features.AbstractFeatureMojo.resolveArtifact(AbstractFeatureMojo.java:144)
      	at org.apache.karaf.tooling.features.AddToRepositoryMojo.copyBundlesToDestRepository(AddToRepositoryMojo.java:75)
      	at org.apache.karaf.tooling.features.AddToRepositoryMojo.execute(AddToRepositoryMojo.java:63)
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
      	... 21 more
      Caused by: java.lang.NullPointerException
      	at org.apache.karaf.tooling.features.AbstractFeatureMojo.resolveArtifact(AbstractFeatureMojo.java:138)
      	... 24 more
      
      
      features.xml
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <features name="myfeatures" xmlns="http://karaf.apache.org/xmlns/features/v1.3.0">
         <feature name="myfeature" version="${project.version}" >
            <bundle start-level="50">blueprint:file:static-content-servlet.xml</bundle>
         </feature>
      </features>
      
      pom.xml
      <plugin>
         <groupId>org.apache.karaf.tooling</groupId>
         <artifactId>karaf-maven-plugin</artifactId>
         <version>4.0.2-SNAPSHOT</version>
         <executions>
            <execution>
               <id>features-add-to-repository</id>
               <phase>prepare-package</phase>
               <goals>
                  <goal>features-add-to-repository</goal>
               </goals>
               <configuration>
                  <descriptors>
                     <descriptor>file:features.xml</descriptor>
                  </descriptors>
                  <repository>target/system</repository>
                  <karafVersion>4.0.1</karafVersion>
               </configuration>
            </execution>
         </executions>
      </plugin>
      

      Seems related to https://issues.apache.org/jira/browse/KARAF-3638, but different. All my other dependencies download and copy into the target repository normally.

      Attachments

        Activity

          People

            ffang Freeman Yue Fang
            dosgiuser John Ellinwood
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: