[ 
http://jira.codehaus.org/browse/MRELEASE-318?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Hobson updated MRELEASE-318:
---------------------------------

    Attachment: MNG-3351-unittest.patch

This is a problem with the release manager not coping with version ranges when 
prompting to resolve snapshots.  See MNG-3351-unittest.patch to reproduce the 
problem.

To fix this we need to decide what the expected behaviour should be, which 
really depends on the outcome of MNG-3092.

For example, the unit test tries to release a project with a dependency version 
of [1.0,1.1) when versions 1.0-SNAPSHOT, 1.0 and 1.1-SNAPSHOT are available.  
If MNG-3092 is not applied, then the range contains 1.1-SNAPSHOT and the user 
is prompted to set the dependency to the release version.  Now do we replace 
the range with 1.1 for releasing and then reinstate the range for further 
development?  If so, we lose the range information in the released pom (which 
is the purpose of release-pom.xml) and how do we then increment the range to 
the next development version?

If MNG-3092 is applied, then the range resolves to 1.0, the user is not 
prompted and release poms will provide the resolved version.  In this scenario 
we would have to extend the prompting code to cater for ranges with snapshot 
boundaries, for example [1.0,1.1-SNAPSHOT].  Here we would derive the release 
version to be [1.0,1.1] and proceed with the release.

Personally I'm in favour of the latter scenario.

> Release plugin throws NullPointerException when using version range for 
> dependency
> ----------------------------------------------------------------------------------
>
>                 Key: MRELEASE-318
>                 URL: http://jira.codehaus.org/browse/MRELEASE-318
>             Project: Maven 2.x Release Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0-beta-7
>            Reporter: David Hoffer
>            Priority: Blocker
>         Attachments: MNG-3351-unittest.patch, MNG-3351.zip, 
> MNG-3351_dependency_poms.zip, simple-test-case-console-log.txt, 
> simple-testcase.zip
>
>
> After upgrading to 2.0.8 I find that the release plugin throws NPE if any 
> dependency uses version range.
> I have one dependency with version range <version>[1.0,2.0)</version> the 
> rest are test scope with fixed version.
> Here is the crash stack trace:
> java.lang.NullPointerException: version was null for 
> com.xrite:xrite-colorlib-api
> [13:42:05]: at 
> org.apache.maven.artifact.DefaultArtifact.getBaseVersion(DefaultArtifact.java:362)
> [13:42:05]: at 
> org.apache.maven.artifact.DefaultArtifact.isSnapshot(DefaultArtifact.java:557)
> [13:42:05]: at 
> org.apache.maven.shared.release.phase.CheckDependencySnapshotsPhase.checkArtifact(CheckDependencySnapshotsPhase.java:252)
> [13:42:05]: at 
> org.apache.maven.shared.release.phase.CheckDependencySnapshotsPhase.checkProject(CheckDependencySnapshotsPhase.java:138)
> [13:42:05]: at 
> org.apache.maven.shared.release.phase.CheckDependencySnapshotsPhase.execute(CheckDependencySnapshotsPhase.java:106)
> [13:42:05]: at 
> org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:194)
> [13:42:05]: at 
> org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:131)
> [13:42:05]: at 
> org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:94)
> [13:42:05]: at 
> org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:127)
> [13:42:05]: at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:447)
> [13:42:05]: at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
> [13:42:05]: at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:513)
> [13:42:05]: at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:483)
> [13:42:05]: at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
> [13:42:05]: at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:228)
> [13:42:05]: at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
> [13:42:05]: at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
> [13:42:05]: at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
> [13:42:05]: at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
> [13:42:05]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [13:42:05]: at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> [13:42:05]: at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> [13:42:05]: at java.lang.reflect.Method.invoke(Method.java:597)
> [13:42:05]: at 
> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
> [13:42:05]: at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> [13:42:05]: at 
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
> [13:42:05]: at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> It seems the reason version is null is that the call to 
> selectVersionFromNewRangeIfAvailable() assumes that 
> versionRange.getRecommendedVersion() will always return non-null, else it 
> sets the version to null!  However during the release:prepare phase this is 
> not true, see the output:
> [13:42:04]: [INFO] [release:prepare]
> [13:42:04]: [INFO] Verifying that there are no local modifications...
> [13:42:04]: [INFO] Executing: svn --non-interactive status
> [13:42:04]: [INFO] Working directory: C:\BuildAgent\work\23044d751bcc9843
> [13:42:05]: [INFO] Checking dependencies and plugins for snapshots ...
> [13:42:05]: TEST!!! version=null
> [13:42:05]: TEST!!! versionRange=[1.0,2.0)
> [13:42:05]: TEST!!! getRecommendedVersion=null
> TEST!!! Lines are my test code so I could see what is going on here.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to