You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jens Mühlenhoff (JIRA)" <ji...@codehaus.org> on 2009/02/26 16:26:19 UTC

[jira] Created: (MRELEASE-416) given dependencies from a release.property file not used during release:prepare

given dependencies from a release.property file not used during release:prepare
-------------------------------------------------------------------------------

                 Key: MRELEASE-416
                 URL: http://jira.codehaus.org/browse/MRELEASE-416
             Project: Maven 2.x Release Plugin
          Issue Type: Bug
          Components: prepare
         Environment: Windows, maven 2.0.10
            Reporter: Jens Mühlenhoff


Create a release.property file which holds all dependency you want to be resolved.

Drung the release:prepare this properties are currently not used to resolve snapshot dependencies:

#release configuration
dependency.test.parent\:root.release=0.0.2
dependency.test.parent\:root.development=0.0.6-SNAPSHOT

The problem seams to be in the method: 
ReleaseUtils.loadResolvedDependencies( ... )
                startIndex = propertyName.lastIndexOf( "dependency." );

The methode lastIndexOf returns in this case always 0 because the last time the string "dependency." was found at the starting position 0.

Until this isn't fixed it is hard to release several projects with one script.

Furthermore it would be good to niticed, that using the release.properties will only work if the resume=flas is toggeled to true.


                 endIndex = propertyName.indexOf( ".development" );
                artifactVersionlessKey = propertyName.substring( startIndex, endIndex );

Currently artifactVersionlessKey will contain "dependency.test.parent:root" which seams to be wrong.

This line must be changed to
                artifactVersionlessKey = propertyName.substring( startIndex+11, endIndex );



-- 
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

       

[jira] Commented: (MRELEASE-416) given dependencies from a release.property file not used during release:prepare

Posted by "Allan Ditzel (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRELEASE-416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=194860#action_194860 ] 

Allan Ditzel commented on MRELEASE-416:
---------------------------------------

Would this issue also be responsible for ignoring a command-line argument of

-Dproject.rel.org.test:test-project=0.2.1

If provide this flag in batch mode the branch plugin doesn't use the version I've specified.

> given dependencies from a release.property file not used during release:prepare
> -------------------------------------------------------------------------------
>
>                 Key: MRELEASE-416
>                 URL: http://jira.codehaus.org/browse/MRELEASE-416
>             Project: Maven 2.x Release Plugin
>          Issue Type: Bug
>          Components: prepare
>         Environment: Windows, maven 2.0.10
>            Reporter: Jens Mühlenhoff
>
> Create a release.property file which holds all dependency you want to be resolved.
> Drung the release:prepare this properties are currently not used to resolve snapshot dependencies:
> #release configuration
> dependency.test.parent\:root.release=0.0.2
> dependency.test.parent\:root.development=0.0.6-SNAPSHOT
> The problem seams to be in the method: 
> ReleaseUtils.loadResolvedDependencies( ... )
>                 startIndex = propertyName.lastIndexOf( "dependency." );
> The methode lastIndexOf returns in this case always 0 because the last time the string "dependency." was found at the starting position 0.
> Until this isn't fixed it is hard to release several projects with one script.
> Furthermore it would be good to niticed, that using the release.properties will only work if the resume=flas is toggeled to true.
>                  endIndex = propertyName.indexOf( ".development" );
>                 artifactVersionlessKey = propertyName.substring( startIndex, endIndex );
> Currently artifactVersionlessKey will contain "dependency.test.parent:root" which seams to be wrong.
> This line must be changed to
>                 artifactVersionlessKey = propertyName.substring( startIndex+11, endIndex );

-- 
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

       

[jira] Issue Comment Edited: (MRELEASE-416) given dependencies from a release.property file not used during release:prepare

Posted by "Jens Mühlenhoff (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRELEASE-416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=167188#action_167188 ] 

Jens Mühlenhoff edited comment on MRELEASE-416 at 2/26/09 11:03 AM:
--------------------------------------------------------------------

As far as I know the properties in the {{release.property}} file must have the following format

{{dependency.${groupid}:${artifactid}.development}} or {{dependency.${groupid}:${artifactid}.release}}

In this case the ReleaseUtils the method could be rewriten like this:

{noformat}
    private static void loadResolvedDependencies( Properties prop, ReleaseDescriptor descriptor )
    {
        Map resolvedDependencies = new HashMap();

        Set entries = prop.entrySet();
        Iterator iterator = entries.iterator();
        while ( iterator.hasNext() )
        {
        	Entry currentEntry = (Entry) iterator.next();
            String propertyName = (String) currentEntry.getKey();

            if ( propertyName.startsWith( "dependency." ) )
            {
                String artifactVersionlessKey = null;
                String versionType = null;
                if ( propertyName.endsWith( ".development" )  )
                {
                	artifactVersionlessKey = propertyName.substring( 11, propertyName.length() - 12 );
                    versionType = ReleaseDescriptor.DEVELOPMENT_KEY;
                }
                else if( propertyName.endsWith( ".release" )  )
                {
                	artifactVersionlessKey = propertyName.substring( 11, propertyName.length() - 9 );
                    versionType = ReleaseDescriptor.RELEASE_KEY;
                }
                
                if( versionType != null && artifactVersionlessKey != null && artifactVersionlessKey.isEmpty() == false ) {
                    Map versionMap = (Map) resolvedDependencies.get( artifactVersionlessKey );
                    if( versionMap == null )
                    {
                        versionMap = new HashMap();
                        resolvedDependencies.put( artifactVersionlessKey, versionMap );
                    }
                    versionMap.put( versionType, currentEntry.getValue() );
                } else {
                	// TODO do some nice warning, that this entry will be ignored
                	// getLogger().info("Ignore property " + propertyName + ". Starts with 'dependency.'"+
                	// "but do not end with '.development' or '.release'" )  
                }
            }
        }

        descriptor.setResolvedSnapshotDependencies( resolvedDependencies );
    }
{noformat}

      was (Author: jens.muehlenhoff):
    As far as I know the properties in the release.property file must have the following format

dependency.${groupid}:${artifactid}.development or dependency.${groupid}:${artifactid}.release

In this case the ReleaseUtils the method could be rewriten like this:

    private static void loadResolvedDependencies( Properties prop, ReleaseDescriptor descriptor )
    {
        Map resolvedDependencies = new HashMap();

        Set entries = prop.entrySet();
        Iterator iterator = entries.iterator();
        while ( iterator.hasNext() )
        {
        	Entry currentEntry = (Entry) iterator.next();
            String propertyName = (String) currentEntry.getKey();

            if ( propertyName.startsWith( "dependency." ) )
            {
                String artifactVersionlessKey = null;
                String versionType = null;
                if ( propertyName.endsWith( ".development" )  )
                {
                	artifactVersionlessKey = propertyName.substring( 11, propertyName.length() - 12 );
                    versionType = ReleaseDescriptor.DEVELOPMENT_KEY;
                }
                else if( propertyName.endsWith( ".release" )  )
                {
                	artifactVersionlessKey = propertyName.substring( 11, propertyName.length() - 9 );
                    versionType = ReleaseDescriptor.RELEASE_KEY;
                }
                
                if( versionType != null && artifactVersionlessKey != null && artifactVersionlessKey.isEmpty() == false ) {
                    Map versionMap = (Map) resolvedDependencies.get( artifactVersionlessKey );
                    if( versionMap == null )
                    {
                        versionMap = new HashMap();
                        resolvedDependencies.put( artifactVersionlessKey, versionMap );
                    }
                    versionMap.put( versionType, currentEntry.getValue() );
                } else {
                	// TODO do some nice warning, that this entry will be ignored
                	// getLogger().info("Ignore property " + propertyName + ". Starts with 'dependency.'"+
                	// "but do not end with '.development' or '.release'" )  
                }
            }
        }

        descriptor.setResolvedSnapshotDependencies( resolvedDependencies );
    }

  
> given dependencies from a release.property file not used during release:prepare
> -------------------------------------------------------------------------------
>
>                 Key: MRELEASE-416
>                 URL: http://jira.codehaus.org/browse/MRELEASE-416
>             Project: Maven 2.x Release Plugin
>          Issue Type: Bug
>          Components: prepare
>         Environment: Windows, maven 2.0.10
>            Reporter: Jens Mühlenhoff
>
> Create a release.property file which holds all dependency you want to be resolved.
> Drung the release:prepare this properties are currently not used to resolve snapshot dependencies:
> #release configuration
> dependency.test.parent\:root.release=0.0.2
> dependency.test.parent\:root.development=0.0.6-SNAPSHOT
> The problem seams to be in the method: 
> ReleaseUtils.loadResolvedDependencies( ... )
>                 startIndex = propertyName.lastIndexOf( "dependency." );
> The methode lastIndexOf returns in this case always 0 because the last time the string "dependency." was found at the starting position 0.
> Until this isn't fixed it is hard to release several projects with one script.
> Furthermore it would be good to niticed, that using the release.properties will only work if the resume=flas is toggeled to true.
>                  endIndex = propertyName.indexOf( ".development" );
>                 artifactVersionlessKey = propertyName.substring( startIndex, endIndex );
> Currently artifactVersionlessKey will contain "dependency.test.parent:root" which seams to be wrong.
> This line must be changed to
>                 artifactVersionlessKey = propertyName.substring( startIndex+11, endIndex );

-- 
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

       

[jira] Commented: (MRELEASE-416) given dependencies from a release.property file not used during release:prepare

Posted by "Jens Mühlenhoff (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRELEASE-416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=167189#action_167189 ] 

Jens Mühlenhoff commented on MRELEASE-416:
------------------------------------------

To perform now releases in a batch mode with the ability to define the version numbers for used snapshot releases I add an extra lookup in the 

CheckDependencySnapshotsPhase.checkArtifact( Artifact artifact, Map originalVersions, ReleaseDescriptor releaseDescriptor ) mehotd.

If there is a resolved snapshot dependency it will return false, like the situation if you allow timestamed snapshots.

The method now looks like this:

    private static boolean checkArtifact( Artifact artifact, Map originalVersions, ReleaseDescriptor releaseDescriptor )
    {
        String versionlessArtifactKey = ArtifactUtils.versionlessKey( artifact.getGroupId(), artifact.getArtifactId() );

        // We are only looking at dependencies external to the project - ignore anything found in the reactor as
        // it's version will be updated
        boolean result = artifact.isSnapshot() &&
            !artifact.getBaseVersion().equals( originalVersions.get( versionlessArtifactKey ) );

        
        // check if this artifact was already successfully resolved
        // FIXME: this could be done with releaseDescriptor.getDependencyReleaseVersion if it is fixed
        if( result && releaseDescriptor.getResolvedSnapshotDependencies() != null ) {
            Map versionMap = (Map) releaseDescriptor.getResolvedSnapshotDependencies().get( versionlessArtifactKey );
            if( versionMap != null && versionMap.get( ReleaseDescriptor.RELEASE_KEY) != null ) {
            	result = false;
            }
        } 
         
        // If we have a snapshot but allowTimestampedSnapshots is true, accept the artifact if the version
        // indicates that it is a timestamped snapshot.
        if ( result && releaseDescriptor.isAllowTimestampedSnapshots() ) {
            result = artifact.getVersion().indexOf( "SNAPSHOT" ) >= 0;
        }

        return result;
    }


> given dependencies from a release.property file not used during release:prepare
> -------------------------------------------------------------------------------
>
>                 Key: MRELEASE-416
>                 URL: http://jira.codehaus.org/browse/MRELEASE-416
>             Project: Maven 2.x Release Plugin
>          Issue Type: Bug
>          Components: prepare
>         Environment: Windows, maven 2.0.10
>            Reporter: Jens Mühlenhoff
>
> Create a release.property file which holds all dependency you want to be resolved.
> Drung the release:prepare this properties are currently not used to resolve snapshot dependencies:
> #release configuration
> dependency.test.parent\:root.release=0.0.2
> dependency.test.parent\:root.development=0.0.6-SNAPSHOT
> The problem seams to be in the method: 
> ReleaseUtils.loadResolvedDependencies( ... )
>                 startIndex = propertyName.lastIndexOf( "dependency." );
> The methode lastIndexOf returns in this case always 0 because the last time the string "dependency." was found at the starting position 0.
> Until this isn't fixed it is hard to release several projects with one script.
> Furthermore it would be good to niticed, that using the release.properties will only work if the resume=flas is toggeled to true.
>                  endIndex = propertyName.indexOf( ".development" );
>                 artifactVersionlessKey = propertyName.substring( startIndex, endIndex );
> Currently artifactVersionlessKey will contain "dependency.test.parent:root" which seams to be wrong.
> This line must be changed to
>                 artifactVersionlessKey = propertyName.substring( startIndex+11, endIndex );

-- 
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

       

[jira] Commented: (MRELEASE-416) given dependencies from a release.property file not used during release:prepare

Posted by "Jens Mühlenhoff (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRELEASE-416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=177622#action_177622 ] 

Jens Mühlenhoff commented on MRELEASE-416:
------------------------------------------

This issue ist still in the 2.0-beta-9 release.

> given dependencies from a release.property file not used during release:prepare
> -------------------------------------------------------------------------------
>
>                 Key: MRELEASE-416
>                 URL: http://jira.codehaus.org/browse/MRELEASE-416
>             Project: Maven 2.x Release Plugin
>          Issue Type: Bug
>          Components: prepare
>         Environment: Windows, maven 2.0.10
>            Reporter: Jens Mühlenhoff
>
> Create a release.property file which holds all dependency you want to be resolved.
> Drung the release:prepare this properties are currently not used to resolve snapshot dependencies:
> #release configuration
> dependency.test.parent\:root.release=0.0.2
> dependency.test.parent\:root.development=0.0.6-SNAPSHOT
> The problem seams to be in the method: 
> ReleaseUtils.loadResolvedDependencies( ... )
>                 startIndex = propertyName.lastIndexOf( "dependency." );
> The methode lastIndexOf returns in this case always 0 because the last time the string "dependency." was found at the starting position 0.
> Until this isn't fixed it is hard to release several projects with one script.
> Furthermore it would be good to niticed, that using the release.properties will only work if the resume=flas is toggeled to true.
>                  endIndex = propertyName.indexOf( ".development" );
>                 artifactVersionlessKey = propertyName.substring( startIndex, endIndex );
> Currently artifactVersionlessKey will contain "dependency.test.parent:root" which seams to be wrong.
> This line must be changed to
>                 artifactVersionlessKey = propertyName.substring( startIndex+11, endIndex );

-- 
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

       

[jira] Commented: (MRELEASE-416) given dependencies from a release.property file not used during release:prepare

Posted by "Jens Mühlenhoff (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRELEASE-416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=167188#action_167188 ] 

Jens Mühlenhoff commented on MRELEASE-416:
------------------------------------------

As far as I know the properties in the release.property file must have the following format

dependency.${groupid}:${artifactid}.development or dependency.${groupid}:${artifactid}.release

In this case the ReleaseUtils the method could be rewriten like this:

    private static void loadResolvedDependencies( Properties prop, ReleaseDescriptor descriptor )
    {
        Map resolvedDependencies = new HashMap();

        Set entries = prop.entrySet();
        Iterator iterator = entries.iterator();
        while ( iterator.hasNext() )
        {
        	Entry currentEntry = (Entry) iterator.next();
            String propertyName = (String) currentEntry.getKey();

            if ( propertyName.startsWith( "dependency." ) )
            {
                String artifactVersionlessKey = null;
                String versionType = null;
                if ( propertyName.endsWith( ".development" )  )
                {
                	artifactVersionlessKey = propertyName.substring( 11, propertyName.length() - 12 );
                    versionType = ReleaseDescriptor.DEVELOPMENT_KEY;
                }
                else if( propertyName.endsWith( ".release" )  )
                {
                	artifactVersionlessKey = propertyName.substring( 11, propertyName.length() - 9 );
                    versionType = ReleaseDescriptor.RELEASE_KEY;
                }
                
                if( versionType != null && artifactVersionlessKey != null && artifactVersionlessKey.isEmpty() == false ) {
                    Map versionMap = (Map) resolvedDependencies.get( artifactVersionlessKey );
                    if( versionMap == null )
                    {
                        versionMap = new HashMap();
                        resolvedDependencies.put( artifactVersionlessKey, versionMap );
                    }
                    versionMap.put( versionType, currentEntry.getValue() );
                } else {
                	// TODO do some nice warning, that this entry will be ignored
                	// getLogger().info("Ignore property " + propertyName + ". Starts with 'dependency.'"+
                	// "but do not end with '.development' or '.release'" )  
                }
            }
        }

        descriptor.setResolvedSnapshotDependencies( resolvedDependencies );
    }


> given dependencies from a release.property file not used during release:prepare
> -------------------------------------------------------------------------------
>
>                 Key: MRELEASE-416
>                 URL: http://jira.codehaus.org/browse/MRELEASE-416
>             Project: Maven 2.x Release Plugin
>          Issue Type: Bug
>          Components: prepare
>         Environment: Windows, maven 2.0.10
>            Reporter: Jens Mühlenhoff
>
> Create a release.property file which holds all dependency you want to be resolved.
> Drung the release:prepare this properties are currently not used to resolve snapshot dependencies:
> #release configuration
> dependency.test.parent\:root.release=0.0.2
> dependency.test.parent\:root.development=0.0.6-SNAPSHOT
> The problem seams to be in the method: 
> ReleaseUtils.loadResolvedDependencies( ... )
>                 startIndex = propertyName.lastIndexOf( "dependency." );
> The methode lastIndexOf returns in this case always 0 because the last time the string "dependency." was found at the starting position 0.
> Until this isn't fixed it is hard to release several projects with one script.
> Furthermore it would be good to niticed, that using the release.properties will only work if the resume=flas is toggeled to true.
>                  endIndex = propertyName.indexOf( ".development" );
>                 artifactVersionlessKey = propertyName.substring( startIndex, endIndex );
> Currently artifactVersionlessKey will contain "dependency.test.parent:root" which seams to be wrong.
> This line must be changed to
>                 artifactVersionlessKey = propertyName.substring( startIndex+11, endIndex );

-- 
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

       

[jira] Commented: (MRELEASE-416) given dependencies from a release.property file not used during release:prepare

Posted by "Jens Mühlenhoff (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRELEASE-416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=177636#action_177636 ] 

Jens Mühlenhoff commented on MRELEASE-416:
------------------------------------------

The equals method of the ReleaseDescriptor does not check the  "resolvedSnapshotDependencies" attribute. Therefore the test case 
PropertiesReleaseDescriptorStoreTest.testReadFromFile does not fail. If you add an extra check for resolvedSnapshotDependencies the test fails.

{code}
    public void testReadFromFile()
        throws ReleaseDescriptorStoreException
    {
        File file = getTestFile( "target/test-classes/release.properties" );

        ReleaseDescriptor config = store.read( file );

        ReleaseDescriptor expected = createExcpectedReleaseConfiguration();
        assertEquals( "check matches", expected, config );
        assertMap(expected.getResolvedSnapshotDependencies(),config.getResolvedSnapshotDependencies() );
    }

private void assertMap(Map expected,Map map) {
        assertEquals(  expected.size(), map.size() );
        Iterator iter = expected.keySet().iterator();
        while(iter.hasNext() ) {
            String key = (String) iter.next();
            if( expected.get(key) instanceof Map ) {
                assertMap( (Map) expected.get(key), (Map) map.get(key) );
            } else {
                assertEquals( expected.get(key), map.get(key) );
            }
        }
    }
{code}

Whiel testing I figured out my patch of loadResolvedDependencies has an error, the fixed version looks like this:

{code}
    private static void loadResolvedDependencies( Properties prop, ReleaseDescriptor descriptor )
    {
        Map resolvedDependencies = new HashMap();

        Set entries = prop.entrySet();
        Iterator iterator = entries.iterator();
        while ( iterator.hasNext() )
        {
            Entry currentEntry = (Entry) iterator.next();
            String propertyName = (String) currentEntry.getKey();

            if ( propertyName.startsWith( "dependency." ) )
            {
                String artifactVersionlessKey = null;
                String versionType = null;
                if ( propertyName.endsWith( ".development" )  )
                {
                    artifactVersionlessKey = propertyName.substring( 11, propertyName.length() - 12 );
                    versionType = ReleaseDescriptor.DEVELOPMENT_KEY;
                }
                else if( propertyName.endsWith( ".release" )  )
                {
                    artifactVersionlessKey = propertyName.substring( 11, propertyName.length() - 8 );
                    versionType = ReleaseDescriptor.RELEASE_KEY;
                }
                
                if( versionType != null && artifactVersionlessKey != null && artifactVersionlessKey.isEmpty() == false ) {
                    Map versionMap = (Map) resolvedDependencies.get( artifactVersionlessKey );
                    if( versionMap == null )
                    {
                        versionMap = new HashMap();
                        resolvedDependencies.put( artifactVersionlessKey, versionMap );
                    }
                    versionMap.put( versionType, currentEntry.getValue() );
                } else {
                        // TODO do some nice warning, that this entry will be ignored
                        // getLogger().info("Ignore property " + propertyName + ". Starts with 'dependency.'"+
                        // "but do not end with '.development' or '.release'" )  
                }
            }
        }

        descriptor.setResolvedSnapshotDependencies( resolvedDependencies );
    }
{code}

> given dependencies from a release.property file not used during release:prepare
> -------------------------------------------------------------------------------
>
>                 Key: MRELEASE-416
>                 URL: http://jira.codehaus.org/browse/MRELEASE-416
>             Project: Maven 2.x Release Plugin
>          Issue Type: Bug
>          Components: prepare
>         Environment: Windows, maven 2.0.10
>            Reporter: Jens Mühlenhoff
>
> Create a release.property file which holds all dependency you want to be resolved.
> Drung the release:prepare this properties are currently not used to resolve snapshot dependencies:
> #release configuration
> dependency.test.parent\:root.release=0.0.2
> dependency.test.parent\:root.development=0.0.6-SNAPSHOT
> The problem seams to be in the method: 
> ReleaseUtils.loadResolvedDependencies( ... )
>                 startIndex = propertyName.lastIndexOf( "dependency." );
> The methode lastIndexOf returns in this case always 0 because the last time the string "dependency." was found at the starting position 0.
> Until this isn't fixed it is hard to release several projects with one script.
> Furthermore it would be good to niticed, that using the release.properties will only work if the resume=flas is toggeled to true.
>                  endIndex = propertyName.indexOf( ".development" );
>                 artifactVersionlessKey = propertyName.substring( startIndex, endIndex );
> Currently artifactVersionlessKey will contain "dependency.test.parent:root" which seams to be wrong.
> This line must be changed to
>                 artifactVersionlessKey = propertyName.substring( startIndex+11, endIndex );

-- 
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

       

[jira] Issue Comment Edited: (MRELEASE-416) given dependencies from a release.property file not used during release:prepare

Posted by "Jens Mühlenhoff (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRELEASE-416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=167189#action_167189 ] 

Jens Mühlenhoff edited comment on MRELEASE-416 at 2/26/09 11:02 AM:
--------------------------------------------------------------------

To perform now releases in a batch mode with the ability to define the version numbers for used snapshot releases I add an extra lookup in the 

CheckDependencySnapshotsPhase.checkArtifact( Artifact artifact, Map originalVersions, ReleaseDescriptor releaseDescriptor ) mehotd.

If there is a resolved snapshot dependency it will return false, like the situation if you allow timestamed snapshots.

The method now looks like this:
        
{noformat}
    private static boolean checkArtifact( Artifact artifact, Map originalVersions, ReleaseDescriptor releaseDescriptor )
    {
        String versionlessArtifactKey = ArtifactUtils.versionlessKey( artifact.getGroupId(), artifact.getArtifactId() );

        // We are only looking at dependencies external to the project - ignore anything found in the reactor as
        // it's version will be updated
        boolean result = artifact.isSnapshot() &&
            !artifact.getBaseVersion().equals( originalVersions.get( versionlessArtifactKey ) );

        
        // check if this artifact was already successfully resolved
        // FIXME: this could be done with releaseDescriptor.getDependencyReleaseVersion if it is fixed
        if( result && releaseDescriptor.getResolvedSnapshotDependencies() != null ) {
            Map versionMap = (Map) releaseDescriptor.getResolvedSnapshotDependencies().get( versionlessArtifactKey );
            if( versionMap != null && versionMap.get( ReleaseDescriptor.RELEASE_KEY) != null ) {
            	result = false;
            }
        } 
         
        // If we have a snapshot but allowTimestampedSnapshots is true, accept the artifact if the version
        // indicates that it is a timestamped snapshot.
        if ( result && releaseDescriptor.isAllowTimestampedSnapshots() ) {
            result = artifact.getVersion().indexOf( "SNAPSHOT" ) >= 0;
        }

        return result;
    }
{noformat}

      was (Author: jens.muehlenhoff):
    To perform now releases in a batch mode with the ability to define the version numbers for used snapshot releases I add an extra lookup in the 

CheckDependencySnapshotsPhase.checkArtifact( Artifact artifact, Map originalVersions, ReleaseDescriptor releaseDescriptor ) mehotd.

If there is a resolved snapshot dependency it will return false, like the situation if you allow timestamed snapshots.

The method now looks like this:

    private static boolean checkArtifact( Artifact artifact, Map originalVersions, ReleaseDescriptor releaseDescriptor )
    {
        String versionlessArtifactKey = ArtifactUtils.versionlessKey( artifact.getGroupId(), artifact.getArtifactId() );

        // We are only looking at dependencies external to the project - ignore anything found in the reactor as
        // it's version will be updated
        boolean result = artifact.isSnapshot() &&
            !artifact.getBaseVersion().equals( originalVersions.get( versionlessArtifactKey ) );

        
        // check if this artifact was already successfully resolved
        // FIXME: this could be done with releaseDescriptor.getDependencyReleaseVersion if it is fixed
        if( result && releaseDescriptor.getResolvedSnapshotDependencies() != null ) {
            Map versionMap = (Map) releaseDescriptor.getResolvedSnapshotDependencies().get( versionlessArtifactKey );
            if( versionMap != null && versionMap.get( ReleaseDescriptor.RELEASE_KEY) != null ) {
            	result = false;
            }
        } 
         
        // If we have a snapshot but allowTimestampedSnapshots is true, accept the artifact if the version
        // indicates that it is a timestamped snapshot.
        if ( result && releaseDescriptor.isAllowTimestampedSnapshots() ) {
            result = artifact.getVersion().indexOf( "SNAPSHOT" ) >= 0;
        }

        return result;
    }

  
> given dependencies from a release.property file not used during release:prepare
> -------------------------------------------------------------------------------
>
>                 Key: MRELEASE-416
>                 URL: http://jira.codehaus.org/browse/MRELEASE-416
>             Project: Maven 2.x Release Plugin
>          Issue Type: Bug
>          Components: prepare
>         Environment: Windows, maven 2.0.10
>            Reporter: Jens Mühlenhoff
>
> Create a release.property file which holds all dependency you want to be resolved.
> Drung the release:prepare this properties are currently not used to resolve snapshot dependencies:
> #release configuration
> dependency.test.parent\:root.release=0.0.2
> dependency.test.parent\:root.development=0.0.6-SNAPSHOT
> The problem seams to be in the method: 
> ReleaseUtils.loadResolvedDependencies( ... )
>                 startIndex = propertyName.lastIndexOf( "dependency." );
> The methode lastIndexOf returns in this case always 0 because the last time the string "dependency." was found at the starting position 0.
> Until this isn't fixed it is hard to release several projects with one script.
> Furthermore it would be good to niticed, that using the release.properties will only work if the resume=flas is toggeled to true.
>                  endIndex = propertyName.indexOf( ".development" );
>                 artifactVersionlessKey = propertyName.substring( startIndex, endIndex );
> Currently artifactVersionlessKey will contain "dependency.test.parent:root" which seams to be wrong.
> This line must be changed to
>                 artifactVersionlessKey = propertyName.substring( startIndex+11, endIndex );

-- 
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