Maven 2.x Release Plugin

generated ReleaseDescriptor contains buggy method: getDependencyDevelopmentVersion and getDependencyReleaseVersion

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: prepare
  • Labels:
    None
  • Number of attachments :
    0

Description

The following two methods will always return null if the attribute resolvedSnapshotDependencies is not null.

Second you can avoid extra lookups by doing a get and check if the value is null (without calling containsKey before).

/**

  • Retrieve the release version for the resolved snapshot dependency.
    *
    */
    public String getDependencyDevelopmentVersion( String artifactConflictId )
    Unknown macro: { if ( ( resolvedSnapshotDependencies == null ) && ( resolvedSnapshotDependencies.containsKey( artifactConflictId ) ) ) { java.util.Map versionMap = ( java.util.Map ) resolvedSnapshotDependencies.get( artifactConflictId ); return ( String ) versionMap.get( DEVELOPMENT_KEY ); } return null; }

/**

  • Retrieve the release version for the resolved snapshot dependency.
    *
    */
    public String getDependencyReleaseVersion( String artifactConflictId )
    Unknown macro: { if ( ( resolvedSnapshotDependencies == null ) && ( resolvedSnapshotDependencies.containsKey( artifactConflictId ) ) ) { java.util.Map versionMap = ( java.util.Map ) resolvedSnapshotDependencies.get( artifactConflictId ); return ( String ) versionMap.get( RELEASE_KEY ); } return null; }

Activity

Hide
Jens Mühlenhoff added a comment - - edited

Sorry, I cant edit my bug, it belongs to the prepare component. VErsion of maven is 2.0.10.

This could be a fix, but I don't know how to tell it maven to use it during code generation:

public String getDependencyDevelopmentVersion( String artifactConflictId )
    {
        if( resolvedSnapshotDependencies != null ) {
            java.util.Map versionMap = ( java.util.Map ) resolvedSnapshotDependencies.get( artifactConflictId );
            if( versionMap != null ) {
                return ( String ) versionMap.get( DEVELOPMENT_KEY );
            }
        }
        return null;
    }

    public String getDependencyReleaseVersion( String artifactConflictId )
    {
        if ( ( resolvedSnapshotDependencies != null ) {
            java.util.Map versionMap = ( java.util.Map ) resolvedSnapshotDependencies.get( artifactConflictId );
            if( versionMap != null ) {
                return ( String ) versionMap.get( RELEASE_KEY );
            }
        }
        return null;
    }
Show
Jens Mühlenhoff added a comment - - edited Sorry, I cant edit my bug, it belongs to the prepare component. VErsion of maven is 2.0.10. This could be a fix, but I don't know how to tell it maven to use it during code generation:
public String getDependencyDevelopmentVersion( String artifactConflictId )
    {
        if( resolvedSnapshotDependencies != null ) {
            java.util.Map versionMap = ( java.util.Map ) resolvedSnapshotDependencies.get( artifactConflictId );
            if( versionMap != null ) {
                return ( String ) versionMap.get( DEVELOPMENT_KEY );
            }
        }
        return null;
    }

    public String getDependencyReleaseVersion( String artifactConflictId )
    {
        if ( ( resolvedSnapshotDependencies != null ) {
            java.util.Map versionMap = ( java.util.Map ) resolvedSnapshotDependencies.get( artifactConflictId );
            if( versionMap != null ) {
                return ( String ) versionMap.get( RELEASE_KEY );
            }
        }
        return null;
    }

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: