Maven 2 & 3

NullPointerException with mvn dependency:sources

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0.7
  • Fix Version/s: 2.0.9, 3.0-alpha-1
  • Component/s: Dependencies
  • Labels:
    None
  • Number of attachments :
    1

Description

I got a NPE when I use mvn dependency:sources to download all the sources for my appfuse M5 project:

$ mvn -e -U dependency:sources
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'dependency'.
[INFO] org.apache.maven.plugins: checking for updates from appfuse
[INFO] org.apache.maven.plugins: checking for updates from central
[INFO] org.codehaus.mojo: checking for updates from appfuse
[INFO] org.codehaus.mojo: checking for updates from central
[INFO] artifact org.apache.maven.plugins:maven-dependency-plugin: checking for updates from appfuse
[INFO] artifact org.apache.maven.plugins:maven-dependency-plugin: checking for updates from central
[INFO] ----------------------------------------------------------------------------
[INFO] Building AppFuse Struts 2 Application
[INFO] task-segment: [dependency:sources]
[INFO] ----------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/codehaus/xfire/bcprov-jdk15/133/bcprov-jdk15-133.pom
Downloading: http://static.appfuse.org/repository/org/codehaus/xfire/bcprov-jdk15/133/bcprov-jdk15-133.pom
Downloading: http://repo1.maven.org/maven2/xml-security/xmlsec/1.3.0/xmlsec-1.3.0.pom
Downloading: http://static.appfuse.org/repository/xml-security/xmlsec/1.3.0/xmlsec-1.3.0.pom
Downloading: http://repo1.maven.org/maven2/wss4j/wss4j/1.5.1/wss4j-1.5.1.pom
Downloading: http://static.appfuse.org/repository/wss4j/wss4j/1.5.1/wss4j-1.5.1.pom
Downloading: http://repo1.maven.org/maven2/xfire/saaj-impl/1.3/saaj-impl-1.3.pom
Downloading: http://static.appfuse.org/repository/xfire/saaj-impl/1.3/saaj-impl-1.3.pom
[INFO] [dependency:sources]
Downloading: http://repo1.maven.org/maven2/ant/ant/1.5/ant-1.5-sources.jar
Downloading: http://static.appfuse.org/repository/ant/ant/1.5/ant-1.5-sources.jar
Downloading: http://repo1.maven.org/maven2/asm/asm/1.5.3/asm-1.5.3-sources.jar
Downloading: http://static.appfuse.org/repository/asm/asm/1.5.3/asm-1.5.3-sources.jar
Downloading: http://repo1.maven.org/maven2/asm/asm-attrs/1.5.3/asm-attrs-1.5.3-sources.jar
Downloading: http://static.appfuse.org/repository/asm/asm-attrs/1.5.3/asm-attrs-1.5.3-sources.jar
Downloading: http://repo1.maven.org/maven2/aspectj/aspectjweaver/1.5.3/aspectjweaver-1.5.3-sources.jar
Downloading: http://static.appfuse.org/repository/aspectj/aspectjweaver/1.5.3/aspectjweaver-1.5.3-sources.jar
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] null
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NullPointerException
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:92)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:73)
at org.apache.maven.plugin.dependency.utils.resolvers.DefaultArtifactsResolver.resolve(DefaultArtifactsResolver.java:81)
at org.apache.maven.plugin.dependency.AbstractDependencyFilterMojo.getClassifierTranslatedDependencies(AbstractDependencyFilterMojo.java:308)
at org.apache.maven.plugin.dependency.AbstractDependencyFilterMojo.getDependencySets(AbstractDependencyFilterMojo.java:265)
at org.apache.maven.plugin.dependency.resolvers.ResolveDependencySourcesMojo.execute(ResolveDependencySourcesMojo.java:69)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
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)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16 seconds
[INFO] Finished at: Tue Aug 17 11:39:04 CEST 2007
[INFO] Final Memory: 9M/17M
[INFO] ------------------------------------------------------------------------

Activity

Hide
Sam Imari added a comment -

pom.xml created using the appfuse project creation command:

mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject

Show
Sam Imari added a comment - pom.xml created using the appfuse project creation command: mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
Hide
John Kew added a comment -

I've encountered this error too. I fixed this by applying a patch similar to:
— maven/artifact/trunk/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java 2007/08/17 06:07:31 566931
+++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java 2007/08/20 14:44:01 567719
@@ -89,6 +89,12 @@
{
File systemFile = artifact.getFile();

+ if ( systemFile == null )
+ { + throw new ArtifactNotFoundException( + "System artifact: " + artifact + " has no file attached", artifact ); + }
+
if ( !systemFile.exists() )
{
throw new ArtifactNotFoundException(

This fix is available in the 2.0.x branch but it was recently removed from trunk in r511859 on Sept. 1st. I won't post a patch since carlos has already committed a similar patch. Here's the revision history for trunk, however:

http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java?view=log

Show
John Kew added a comment - I've encountered this error too. I fixed this by applying a patch similar to: — maven/artifact/trunk/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java 2007/08/17 06:07:31 566931 +++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java 2007/08/20 14:44:01 567719 @@ -89,6 +89,12 @@ { File systemFile = artifact.getFile(); + if ( systemFile == null ) + { + throw new ArtifactNotFoundException( + "System artifact: " + artifact + " has no file attached", artifact ); + } + if ( !systemFile.exists() ) { throw new ArtifactNotFoundException( This fix is available in the 2.0.x branch but it was recently removed from trunk in r511859 on Sept. 1st. I won't post a patch since carlos has already committed a similar patch. Here's the revision history for trunk, however: http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java?view=log
Hide
John Kew added a comment -

My suggestion for Sam is to try out the 2.0.x branch from subversion.

Show
John Kew added a comment - My suggestion for Sam is to try out the 2.0.x branch from subversion.
Hide
Vincent Siveton added a comment -

The fix is already present on branch and trunk (r609337)

Show
Vincent Siveton added a comment - The fix is already present on branch and trunk (r609337)

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: