Maven
  1. Maven
  2. MNG-2961

DefaultArtifact getBaseVersion is changed to "xxxx-SNAPSHOT" only if you first call isSnapshot()

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7
    • Fix Version/s: 2.0.8, 3.0-alpha-1
    • Labels:
      None
    • Complexity:
      Intermediate
    • Patch Submitted:
      Yes
    • Number of attachments :
      1

      Description

      calling isSnapshot() actually modifies the baseVersion:

      public boolean isSnapshot()
      {
      if ( version != null || baseVersion != null )
      {
      Matcher m = VERSION_FILE_PATTERN.matcher( getBaseVersion() );
      if ( m.matches() )

      { setBaseVersion( m.group( 1 ) + "-" + SNAPSHOT_VERSION ); return true; }

      else

      { return getBaseVersion().endsWith( SNAPSHOT_VERSION ) || getBaseVersion().equals( LATEST_VERSION ); }

      }
      else

      { return false; }

      }

        Issue Links

          Activity

          Hide
          Herve Boutemy added a comment -

          with this patch, baseVersion attribute is only set by its setter setBaseVersion(), which does the -SNAPSHOT conversion

          Show
          Herve Boutemy added a comment - with this patch, baseVersion attribute is only set by its setter setBaseVersion(), which does the -SNAPSHOT conversion
          Hide
          John Casey added a comment -

          Applied, and added my own unit test to verify the fix. Thanks, Brian!

          Show
          John Casey added a comment - Applied, and added my own unit test to verify the fix. Thanks, Brian!

            People

            • Assignee:
              John Casey
              Reporter:
              brianfox brianfox
            • Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: