jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2 & 3
  • MNG-2635

DefaultArtifactCollector.recurse can lose versionRange

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.0.7
  • Component/s: Artifacts and Repositories
  • Labels:
    None
  • Environment:
    Linux
  • Complexity:
    Intermediate

Description

This affects maven 2.0.4 and 2.0.5 (at least).

I'm not quite sure how to reproduce the bug in a simple test case, but we have a setup where running the command:
mvn install site source:jar
crashes in ArtifactUtils.copyArtifact because artifact.getVersionRange() returns null.
The code that seems to be causing the problem is in DefaultArtifactCollector.recurse(). Because the Artifact sets the version in setVersionRange, but can't set the VersionRange from setVersion, the VersionRange should take precedence if it exists. A simple diff follows:

Index: components/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
===================================================================
— components/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java (revision 467177)
+++ components/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java (working copy)
@@ -114,8 +114,13 @@

fireEvent( ResolutionListener.MANAGE_ARTIFACT, listeners, node, artifact );

  • if ( artifact.getVersion() != null )
    + VersionRange range = artifact.getVersionRange();
    + if (range != null) { + node.getArtifact().setVersionRange(range); + }

    + else if ( artifact.getVersion() != null )
    + { node.getArtifact().setVersion( artifact.getVersion() ); }
    if ( artifact.getScope() != null )

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. File
    artifact_patch
    26/Oct/06 7:32 PM
    1.0 kB
    Bud Osterberg

Issue Links

is related to

Bug - A problem which impairs or prevents the functions of the product. MNG-2928 Null pointer exeception when introducing version range [major.minor.build-SNAPSHOT,)

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Brian Fox added a comment - 05/Mar/08 7:22 PM

Can you see if this still occurs in later versions? The code is different and without a test to validate, I don't want to just throw changes in here.

Show
Brian Fox added a comment - 05/Mar/08 7:22 PM Can you see if this still occurs in later versions? The code is different and without a test to validate, I don't want to just throw changes in here.
Hide
Permalink
Bud Osterberg added a comment - 12/Mar/08 2:01 PM

This seems to work OK in 2.0.7 and 2.0.8.

Show
Bud Osterberg added a comment - 12/Mar/08 2:01 PM This seems to work OK in 2.0.7 and 2.0.8.

People

  • Assignee:
    Brian Fox
    Reporter:
    Bud Osterberg
Vote (1)
Watch (2)

Dates

  • Created:
    26/Oct/06 7:32 PM
    Updated:
    12/Mar/08 2:02 PM
    Resolved:
    12/Mar/08 2:02 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.