The second one looks right to me, this is what I've always used as reference[1]

[1] 
http://www.sonatype.com/people/2008/05/maven-code-how-to-detect-if-you-have-a-snapshot-version/

On Mon, Feb 27, 2012 at 6:41 PM, Robert Scholte
<[email protected]> wrote:
> A couple of issues of the release-plugin have to do with SNAPSHOTs, because
> it uses its own definition, borrowed from  (an old) DefaultArtifact.
>
> However, it seems like there are 2 definitions:
> In DefaultArtifact:
>    public boolean isSnapshot()
>    {
>        return getBaseVersion() != null
>            && ( getBaseVersion().endsWith( SNAPSHOT_VERSION ) ||
> getBaseVersion().equals( LATEST_VERSION ) );
>    }
>
> In ArtifactUtils:
>    public static boolean isSnapshot( String version )
>    {
>        if ( version != null )
>        {
>            if ( version.regionMatches( true, version.length() -
> Artifact.SNAPSHOT_VERSION.length(),
>                                        Artifact.SNAPSHOT_VERSION, 0,
> Artifact.SNAPSHOT_VERSION.length() ) )
>            {
>                return true;
>            }
>            else if ( Artifact.VERSION_FILE_PATTERN.matcher( version
> ).matches() )
>            {
>                return true;
>            }
>        }
>        return false;
>    }
>
>
> It looks to me there should only be one. Do I really have to check both
> definitions or can we merge them somehow?
>
> -Robert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to