Uploaded image for project: 'Maven Dependency Plugin'
  1. Maven Dependency Plugin
  2. MDEP-67

NPE when resolving the version of a dependency

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0-alpha-1
    • 2.0-alpha-2
    • None
    • None

    Description

      In my project I have the following dependency

      <dependency>
           <groupId>com.foo.shared.bar</groupId>
           <artifactId>foo-bar</artifactId>
           <version>5.8.3</version>
           <classifier>obfuscated</classifier>    
       </dependency>
      

      I try to get the sources without specifying the version so I have the following config:

      <plugin>
               <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                    <executions>
                          <execution>
                              <id>copy</id>
                              <phase>compile</phase>
                              <goals>
                                  <goal>copy</goal>
                              </goals>
                              <configuration>
                                  <artifactItems>
                                      <artifactItem>
                                          <groupId>com.foo.shared.bar</groupId>
                                          <artifactId>foo-bar</artifactId>
                                          <type>java-source</type>
                                          <outputDirectory>${project.build.directory}/foo-sources</outputDirectory>                                    
                                      </artifactItem>
                                  </artifactItems>
                              </configuration>
                          </execution>
                      </executions>
                  </plugin>
      

      And I got this

      java.lang.NullPointerException
              at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.fillMissingArtifactVersion(AbstractFromConfigurationMojo.java:230)
              at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getProcessedArtifactItems(AbstractFromConfigurationMojo.java:136)
              at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.execute(CopyMojo.java:65)
              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
              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:585)
              at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
              at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
              at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
              at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      

      Attachments

        Activity

          People

            brianf Brian E Fox
            snicoll Stephane Nicoll
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: