Package org.apache.maven.shared.release.versions

Examples of org.apache.maven.shared.release.versions.VersionInfo


        {
            model.setName( model.getArtifactId() );
        }
        params.put( "name", model.getName() );

        VersionInfo version = new DefaultVersionInfo( model.getVersion() );

        params.put( "release", version.getReleaseVersionString() );
        params.put( "dev", version.getNextVersion().getSnapshotVersionString() );

        projects.add( params );
    }
View Full Code Here


        {
            model.setName( model.getArtifactId() );
        }
        params.put( "name", model.getName() );

        VersionInfo version = new DefaultVersionInfo( model.getVersion() );

        params.put( "release", version.getReleaseVersionString() );
        params.put( "dev", version.getNextVersion().getSnapshotVersionString() );

        projects.add( params );
    }
View Full Code Here

        {
            Artifact currentArtifact = iterator.next();
            String versionlessKey = ArtifactUtils.versionlessKey( currentArtifact );

            Map<String, String> versionMap = new HashMap<String, String>();
            VersionInfo versionInfo = new DefaultVersionInfo( currentArtifact.getVersion() );
            versionMap.put( ReleaseDescriptor.ORIGINAL_VERSION, versionInfo.toString() );

            prompter.showMessage(
                "Dependency '" + versionlessKey + "' is a snapshot (" + currentArtifact.getVersion() + ")\n" );
            String result = prompter.prompt( "Which release version should it be set to?",
                                             versionInfo.getReleaseVersionString() );
            versionMap.put( ReleaseDescriptor.RELEASE_KEY, result );

            iterator.remove();

            // by default, keep the same version for the dependency after release, unless it was previously newer
            // the user may opt to type in something different
            VersionInfo nextVersionInfo = new DefaultVersionInfo( result );

            String nextVersion;
            if ( nextVersionInfo.compareTo( versionInfo ) > 0 )
            {
                nextVersion = nextVersionInfo.toString();
            }
            else
            {
                nextVersion = versionInfo.toString();
            }
View Full Code Here

        {
            model.setName( model.getArtifactId() );
        }
        params.put( "name", model.getName() );

        VersionInfo version = new DefaultVersionInfo( model.getVersion() );

        params.put( "release", version.getReleaseVersionString() );
        params.put( "dev", version.getNextVersion().getSnapshotVersionString() );

        projects.add( params );
    }
View Full Code Here

        {
            model.setName( model.getArtifactId() );
        }
        params.put( "name", model.getName() );

        VersionInfo version = new DefaultVersionInfo( model.getVersion() );

        params.put( "release", version.getReleaseVersionString() );
        params.put( "dev", version.getNextVersion().getSnapshotVersionString() );

        projects.add( params );
    }
View Full Code Here

        {
            Artifact currentArtifact = iterator.next();
            String versionlessKey = ArtifactUtils.versionlessKey( currentArtifact );

            Map<String, String> versionMap = new HashMap<String, String>();
            VersionInfo versionInfo = new DefaultVersionInfo( currentArtifact.getVersion() );
            versionMap.put( ReleaseDescriptor.ORIGINAL_VERSION, versionInfo.toString() );

            prompter.showMessage(
                "Dependency '" + versionlessKey + "' is a snapshot (" + currentArtifact.getVersion() + ")\n" );
            String result = prompter.prompt( "Which release version should it be set to?",
                                             versionInfo.getReleaseVersionString() );
            versionMap.put( ReleaseDescriptor.RELEASE_KEY, result );

            iterator.remove();

            // by default, keep the same version for the dependency after release, unless it was previously newer
            // the user may opt to type in something different
            VersionInfo nextVersionInfo = new DefaultVersionInfo( result );

            String nextVersion;
            if ( nextVersionInfo.compareTo( versionInfo ) > 0 )
            {
                nextVersion = nextVersionInfo.toString();
            }
            else
            {
                nextVersion = versionInfo.toString();
            }
View Full Code Here

                                   ReleaseResult result )
        throws ReleaseExecutionException
    {
        String nextVersion = null;

        VersionInfo currentVersionInfo = null;
        VersionInfo releaseVersionInfo = null;
        boolean releaseVersionIsExplicit = false;

        VersionInfo nextSnapshotVersionInfo = null;
        boolean nextSnapshotVersionIsExplicit = false;

        try
        {
            currentVersionInfo = new DefaultVersionInfo( project.getVersion() );

            // The release/branch version defaults to currentVersionInfo (snapshot for branch, and release for tag)
            releaseVersionInfo = currentVersionInfo;

            // Check if the user specified a release version
            if ( releaseDescriptor.getDefaultReleaseVersion() != null )
            {
                releaseVersionInfo = new DefaultVersionInfo( releaseDescriptor.getDefaultReleaseVersion() );
                releaseVersionIsExplicit = true;
            }
            if ( releaseDescriptor.getReleaseVersions() != null )
            {
                String releaseVersion = ( String ) releaseDescriptor.getReleaseVersions().get( projectId );
                if ( releaseVersion != null )
                {
                    releaseVersionInfo = new DefaultVersionInfo( releaseVersion );
                    releaseVersionIsExplicit = true;
                }
            }

            // The next snapshot version defaults to the next version after the release version
            nextSnapshotVersionInfo = releaseVersionInfo.getNextVersion();

            // Check if the user specified a new snapshot version
            if ( releaseDescriptor.getDefaultDevelopmentVersion() != null )
            {
                nextSnapshotVersionInfo = new DefaultVersionInfo( releaseDescriptor.getDefaultDevelopmentVersion() );
                nextSnapshotVersionIsExplicit = true;
            }
            if ( releaseDescriptor.getDevelopmentVersions() != null )
            {
                String nextDevVersion = ( String ) releaseDescriptor.getDevelopmentVersions().get( projectId );
                if ( nextDevVersion != null )
                {
                    nextSnapshotVersionInfo = new DefaultVersionInfo( nextDevVersion );
                    nextSnapshotVersionIsExplicit = true;
                }
            }

        }
        catch ( VersionParseException e )
        {
            String msg = "Error parsing version, cannot determine next version: " + e.getMessage();
            if ( releaseDescriptor.isInteractive() )
            {
                logWarn( result, msg );
                logDebug( result, e.getMessage(), e );

                // set defaults for resume in interactive mode
                if ( releaseVersionInfo == null )
                {
                    try
                    {
                        releaseVersionInfo = new DefaultVersionInfo( "1.0" );
                    }
                    catch ( VersionParseException e1 )
                    {
                        // if that happens we are in serious trouble!
                        throw new ReleaseExecutionException( "Version 1.0 could not be parsed!", e1 );
                    }
                }

                if ( nextSnapshotVersionInfo == null )
                {
                    nextSnapshotVersionInfo = releaseVersionInfo.getNextVersion();
                }
            }
            else
            {
                // cannot proceed without a next value in batch mode
                throw new ReleaseExecutionException( msg, e );
            }
        }

        try
        {
            if ( convertToSnapshot )
            {
                if ( releaseDescriptor.isBranchCreation() )
                {
                    if ( convertToBranch )
                    {
                        // branch modification
                        if ( releaseDescriptor.isUpdateBranchVersions()
                            && ( ArtifactUtils.isSnapshot( project.getVersion() ) || releaseDescriptor.isUpdateVersionsToSnapshot() ) )
                        {
                            nextVersion = releaseVersionInfo.getSnapshotVersionString();
                            if ( !releaseVersionIsExplicit && releaseDescriptor.isInteractive() )
                            {
                                nextVersion = prompter.prompt(
                                    "What is the branch version for \"" + project.getName() + "\"? (" + projectId + ")",
                                    nextVersion );
                            }
                        }
                        else
                        {
                            nextVersion = project.getVersion();
                        }

                    }
                    else
                    {
                        // working copy modification
                        if ( ArtifactUtils.isSnapshot( project.getVersion() )
                            && releaseDescriptor.isUpdateWorkingCopyVersions() )
                        {
                            nextVersion = nextSnapshotVersionInfo.getSnapshotVersionString();
                            if ( releaseDescriptor.isInteractive() && !nextSnapshotVersionIsExplicit )
                            {
                                nextVersion =
                                    prompter.prompt( "What is the new working copy version for \"" + project.getName()
                                        + "\"? (" + projectId + ")", nextVersion );
                            }
                        }
                        else
                        {
                            nextVersion = project.getVersion();
                        }
                    }
                }
                else
                {
                    if( releaseDescriptor.isUpdateWorkingCopyVersions() )
                    {
                        nextVersion = nextSnapshotVersionInfo.getSnapshotVersionString();
                        if ( releaseDescriptor.isInteractive()  && !nextSnapshotVersionIsExplicit )
                        {
                            nextVersion =
                                prompter.prompt( "What is the new development version for \"" + project.getName() + "\"? ("
                                    + projectId + ")", nextVersion );
View Full Code Here

        {
            model.setName( model.getArtifactId() );
        }
        params.put( "name", model.getName() );

        VersionInfo version = new DefaultVersionInfo( model.getVersion() );

        params.put( "release", version.getReleaseVersionString() );
        params.put( "dev", version.getNextVersion().getSnapshotVersionString() );

        projects.add( params );
    }
View Full Code Here

                                   ReleaseResult result )
        throws ReleaseExecutionException
    {
        String nextVersion = null;

        VersionInfo currentVersionInfo = null;
        VersionInfo releaseVersionInfo = null;
        boolean releaseVersionIsExplicit = false;

        VersionInfo nextSnapshotVersionInfo = null;
        boolean nextSnapshotVersionIsExplicit = false;

        try
        {
            currentVersionInfo = new DefaultVersionInfo( project.getVersion() );

            // The release/branch version defaults to currentVersionInfo (snapshot for branch, and release for tag)
            releaseVersionInfo = currentVersionInfo;

            // Check if the user specified a release version
            if ( releaseDescriptor.getDefaultReleaseVersion() != null )
            {
                releaseVersionInfo = new DefaultVersionInfo( releaseDescriptor.getDefaultReleaseVersion() );
                releaseVersionIsExplicit = true;
            }
            if ( releaseDescriptor.getReleaseVersions() != null )
            {
                String releaseVersion = ( String ) releaseDescriptor.getReleaseVersions().get( projectId );
                if ( releaseVersion != null )
                {
                    releaseVersionInfo = new DefaultVersionInfo( releaseVersion );
                    releaseVersionIsExplicit = true;
                }
            }

            // The next snapshot version defaults to the next version after the release version
            nextSnapshotVersionInfo = releaseVersionInfo.getNextVersion();

            // Check if the user specified a new snapshot version
            if ( releaseDescriptor.getDefaultDevelopmentVersion() != null )
            {
                nextSnapshotVersionInfo = new DefaultVersionInfo( releaseDescriptor.getDefaultDevelopmentVersion() );
                nextSnapshotVersionIsExplicit = true;
            }
            if ( releaseDescriptor.getDevelopmentVersions() != null )
            {
                String nextDevVersion = ( String ) releaseDescriptor.getDevelopmentVersions().get( projectId );
                if ( nextDevVersion != null )
                {
                    nextSnapshotVersionInfo = new DefaultVersionInfo( nextDevVersion );
                    nextSnapshotVersionIsExplicit = true;
                }
            }

        }
        catch ( VersionParseException e )
        {
            String msg = "Error parsing version, cannot determine next version: " + e.getMessage();
            if ( releaseDescriptor.isInteractive() )
            {
                logWarn( result, msg );
                logDebug( result, e.getMessage(), e );

                // set defaults for resume in interactive mode
                if ( releaseVersionInfo == null )
                {
                    try
                    {
                        releaseVersionInfo = new DefaultVersionInfo( "1.0" );
                    }
                    catch ( VersionParseException e1 )
                    {
                        // if that happens we are in serious trouble!
                        throw new ReleaseExecutionException( "Version 1.0 could not be parsed!", e1 );
                    }
                }

                if ( nextSnapshotVersionInfo == null )
                {
                    nextSnapshotVersionInfo = releaseVersionInfo.getNextVersion();
                }
            }
            else
            {
                // cannot proceed without a next value in batch mode
                throw new ReleaseExecutionException( msg, e );
            }
        }

        try
        {
            if ( convertToSnapshot )
            {
                if ( releaseDescriptor.isBranchCreation() )
                {
                    if ( convertToBranch )
                    {
                        // branch modification
                        if ( releaseDescriptor.isUpdateBranchVersions()
                            && ( ArtifactUtils.isSnapshot( project.getVersion() ) || releaseDescriptor.isUpdateVersionsToSnapshot() ) )
                        {
                            nextVersion = releaseVersionInfo.getSnapshotVersionString();
                            if ( !releaseVersionIsExplicit && releaseDescriptor.isInteractive() )
                            {
                                nextVersion = prompter.prompt(
                                    "What is the branch version for \"" + project.getName() + "\"? (" + projectId + ")",
                                    nextVersion );
                            }
                        }
                        else
                        {
                            nextVersion = project.getVersion();
                        }

                    }
                    else
                    {
                        // working copy modification
                        if ( ArtifactUtils.isSnapshot( project.getVersion() )
                            && releaseDescriptor.isUpdateWorkingCopyVersions() )
                        {
                            nextVersion = nextSnapshotVersionInfo.getSnapshotVersionString();
                            if ( releaseDescriptor.isInteractive() && !nextSnapshotVersionIsExplicit )
                            {
                                nextVersion =
                                    prompter.prompt( "What is the new working copy version for \"" + project.getName()
                                        + "\"? (" + projectId + ")", nextVersion );
                            }
                        }
                        else
                        {
                            nextVersion = project.getVersion();
                        }
                    }
                }
                else
                {
                    nextVersion = nextSnapshotVersionInfo.getSnapshotVersionString();
                    if ( releaseDescriptor.isInteractive()  && !nextSnapshotVersionIsExplicit )
                    {
                        nextVersion =
                            prompter.prompt( "What is the new development version for \"" + project.getName() + "\"? ("
                                + projectId + ")", nextVersion );
View Full Code Here

        {
            Artifact currentArtifact = iterator.next();
            String versionlessKey = ArtifactUtils.versionlessKey( currentArtifact );

            Map<String, String> versionMap = new HashMap<String, String>();
            VersionInfo versionInfo = new DefaultVersionInfo( currentArtifact.getVersion() );
            versionMap.put( ReleaseDescriptor.ORIGINAL_VERSION, versionInfo.toString() );

            prompter.showMessage(
                "Dependency '" + versionlessKey + "' is a snapshot (" + currentArtifact.getVersion() + ")\n" );
            String result = prompter.prompt( "Which release version should it be set to?",
                                             versionInfo.getReleaseVersionString() );
            versionMap.put( ReleaseDescriptor.RELEASE_KEY, result );

            iterator.remove();

            // by default, keep the same version for the dependency after release, unless it was previously newer
            // the user may opt to type in something different
            VersionInfo nextVersionInfo = new DefaultVersionInfo( result );

            String nextVersion;
            if ( nextVersionInfo.compareTo( versionInfo ) > 0 )
            {
                nextVersion = nextVersionInfo.toString();
            }
            else
            {
                nextVersion = versionInfo.toString();
            }
View Full Code Here

TOP

Related Classes of org.apache.maven.shared.release.versions.VersionInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.