Yes, the NPE occurs when no version is found, rather like the other bugreports.
But the scary part about this is something different. It is that it appears that the version specification is silently ignored. In the example below, there is no version to "fall back to" so the NPE occurs. But if there is a version to "fall back to", eg a dependencyManagement entry in the parent pom then no NPE occurs, and the version specified in the pom is just silently ignored. This seems to be a different issue than the ones about the NPE. Unless someone can tell me this is user error, I'll file a separate issue for this. Regards, Simon ---- "Brian E. Fox" <[EMAIL PROTECTED]> schrieb: > Looks like the same npe as MNG-3372 and MNG-3351 > > -----Original Message----- > From: Simon Kitching [mailto:[EMAIL PROTECTED] > Sent: Monday, February 11, 2008 7:51 AM > To: [email protected] > Subject: Weird behaviour with dependency range > > Hi, > > I've run across something very odd with dependency ranges. > > Maven version: 2.0.8 > java: 1.6 > > If I put this in my pom > <dependency> > <groupId>commons-logging</groupId> > <artifactId>commons-logging</artifactId> > <version>[1.0.9]</version> > </dependency> > then run dependency:tree I get an error: > > <output> > Couldn't find a version in [1.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.1, 1.1.1, > 1.1.1-SNAPSHOT] to match range [1.0.9,1.0.9] > </output> > > So far so good. But if I change this to 1.0.1, I get this: > > java.lang.NullPointerException: version was null for > commons-logging:commons-logging > at > org.apache.maven.artifact.DefaultArtifact.getBaseVersion(DefaultArtifact.java:362) > at > org.apache.maven.artifact.DefaultArtifact.getId(DefaultArtifact.java:225) > > > Any idea what is going on here? > > The initial problem I struck was even subtler; a parent pom was using > dependencyManagement to set the version. I tried to override in the child pom > but dependency:tree was still reporting the version defined in the parent. > > It looks like [version] fails correctly when the version does not exist, but > is silently ignored when the version actually exists. > > The same thing happens for [1.0,1.1.1) and similar ranges. > > Regards, > Simon > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
