|
I think this should be reopened, but would still request more information. I don't believe the scope is related - by looking at the code causing the NPE it is clearly that it is unable match a range against a set of versions (we should add another guard to this line of code and deal with it appropriately) Unfortunately the pom file used is a child of an aggregated build, which depends on another aggregated build, so apart from eyeballing the pom file it's unlikely to be much direct help. Will attach it regardless. Looking at the code, the NPE happens at this line: List previousNodes = (List) resolvedArtifacts.get( key ); which if I am reading correctly, should only happen if the variable resolvedArtifacts is set to null. Following the trace back, resolvedArtifacts gets set in just one place: org.apache.maven.artifact.resolver.DefaultArtifactCollector.collect(DefaultArtifactCollector.java:66) like this: Map resolvedArtifacts = new HashMap(); I am struggling to get this to work in a debugger, once I figure that out I'll be able to step through this code and get a clearer picture of what is going on. Sorry, I'm being a moron - the debugger was pointing at the wrong code. The line that is NPEing is this one: 164: resetArtifact.selectVersion( resetArtifact.getVersionRange().matchVersion( Or, to be more specific, the following statement returns null: resetArtifact.getVersionRange().matchVersion( which is in turn not handled. Digging deeper, if I evaluate the expression resetArtifact.getAvailableVersions() it evaluates to the single entry [3.2.0]. If I evaluate resetArtifact.getVersionRange().toString() it evaluates to "". Based on this it seems the case of where the list of available versions is not inside the version range, this case in currently unhandled. I don't know what the correct way would be to handle this, does anyone know what this code is trying to do? The attached patch fixes the NullPointerException. We encountered the some NPE using maven 2.0.6 without exactly knowing the reason. Just upgrading 2.0.7 fixed our problem. Maybe ok to close this issue? v2.0.7 fixes the issue for me. |
|||||||||||||||||||||||||||||||||||||||||
Provide a POM we can use. A stack trace is not enough for us to reproduce the problem.