maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jared Roberts (JIRA)" <>
Subject [jira] Commented: (MNG-5103) NPE thrown when DefaultArtifact.getSelectedVersion is called
Date Tue, 24 May 2011 23:14:22 GMT


Jared Roberts commented on MNG-5103:

I'm resurrecting this from MNG-4887 because I also ran into the same issue. For certain artifacts,
it seems that the versionRange does not get initialized and will throw an NPE when [{{DefaultArtifact.getSelectedVersion()}}|]
is called. I encountered it while using Maven 2.1.0 and 2.2.1. Switching to 3.0.1 resolved
my specific issue, so I assume something changed in the way the Artifact gets created. The
original poster referenced using {{DefaultArtifact.getVersionRange()}} where there is a relevant
hinting that further investigation was probably needed.

I worked around the issue by using the following code block
Artifact dep = ...;
ArtifactVersion selectedVersion = dep.getSelectedVersion();
Artifact dep = ...;
ArtifactVersion selectedVersion = dep.getVersionRange().getSelectedVersion(dep);

> NPE thrown when DefaultArtifact.getSelectedVersion is called
> ------------------------------------------------------------
>                 Key: MNG-5103
>                 URL:
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Artifacts and Repositories
>    Affects Versions: 3.0
>         Environment: not env dependent
>            Reporter: Jared Roberts
> getSelectedVersion() uses the versionRange variable directly instead of using getVersionRange()
which creates the version range from version if its null.
> This bug when using the appfuse warpath plugin when doing a double war overlay

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


View raw message