[ 
https://issues.apache.org/jira/browse/MRELEASE-856?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Osipov closed MRELEASE-856.
-----------------------------------
    Resolution: Auto Closed

This issue has been auto closed because it has been inactive for a long period 
of time. If you think this issue still applies, retest your problem with the 
most recent version of Maven and the affected component, reopen and post your 
results.

> setAllowTimestampedSnapshots allows non-timestamped snapshots
> -------------------------------------------------------------
>
>                 Key: MRELEASE-856
>                 URL: https://issues.apache.org/jira/browse/MRELEASE-856
>             Project: Maven Release Plugin
>          Issue Type: Bug
>    Affects Versions: 2.4.2
>            Reporter: John Gibson
>            Priority: Major
>         Attachments: allowTimestampedSnapshots_broken_test.patch
>
>
> The documentation for the *setAllowTimestampedSnapshots* configuration option 
> (aka *-DignoreSnapshots=true* command line option) claims that it will only 
> allow timestamped SNAPSHOTs.  However it really allows any SNAPSHOTs, 
> including untimestamped ones.
> Part of the code tries to support this:
> {code:title=CheckDependencySnapshotsPhase.java}
>     private static boolean checkArtifact( Artifact artifact, Map<String, 
> String> 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 ) );
>         // 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( Artifact.SNAPSHOT_VERSION 
> ) >= 0;
>         }
>         return result;
>     }
> {code}
> However that check is rendered useless by the main execute method which skips 
> all of the checks when the *allowTimestampedSnapshots* configuration option 
> is true.
> {code:title=CheckDependencySnapshotsPhase.java}
>     public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, 
> ReleaseEnvironment releaseEnvironment, List<MavenProject> reactorProjects )
>         throws ReleaseExecutionException, ReleaseFailureException
>     {
>         ReleaseResult result = new ReleaseResult();
>         if ( !releaseDescriptor.isAllowTimestampedSnapshots() )
>         {
>             logInfo( result, "Checking dependencies and plugins for snapshots 
> ..." );
>             Map<String, String> originalVersions = 
> releaseDescriptor.getOriginalVersions( reactorProjects );
>             for ( MavenProject project : reactorProjects )
>             {
>                 checkProject( project, originalVersions, releaseDescriptor );
>             }
>         }
>         else
>         {
>             logInfo( result, "Ignoring SNAPSHOT depenedencies and plugins 
> ..." );
>         }
>         result.setResultCode( ReleaseResult.SUCCESS );
>         return result;
>     }
> {code}
> See the attached test case for an example of it breaking.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to