~ubuntu-branches/ubuntu/utopic/build-helper-maven-plugin/utopic

« back to all changes in this revision

Viewing changes to src/main/java/org/codehaus/mojo/buildhelper/ParseVersionMojo.java

  • Committer: Package Import Robot
  • Author(s): tony mancill, Emmanuel Bourg, tony mancill
  • Date: 2013-06-01 20:19:34 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130601201934-hzv7zmdcgazfyupp
Tags: 1.7-1
[ Emmanuel Bourg ]
* Team upload.
* New upstream release
* Set the compiler source/target to 1.5
* Updated Standards-Version to 3.9.4 (no changes)
* debian/copyright:
  - Updated the Format URI to 1.0
  - Removed the duplicate Copyright fields

[ tony mancill ]
* debian/control:
  - Add libmaven-invoker-plugin-java to build-depends-indep.
  - Wrap long lines.
  - Update Vcs-Git URL.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
import org.apache.maven.plugin.AbstractMojo;
30
30
import org.apache.maven.plugin.MojoExecutionException;
31
31
import org.apache.maven.project.MavenProject;
32
 
import org.codehaus.plexus.util.StringUtils;
33
32
 
34
33
import java.util.Properties;
35
34
 
55
54
 * For example, 1.0.2-beta-1 will be converted to 1.0.2.beta-1
56
55
 *
57
56
 * @author pgier
58
 
 * @version $Id: ParseVersionMojo.java 11883 2010-02-12 08:25:15Z dennisl $
 
57
 * @version $Id: ParseVersionMojo.java 14202 2011-06-21 20:50:25Z rfscholte $
59
58
 * @goal parse-version
60
59
 * @phase validate
61
60
 * @since 1.3
62
 
 *
 
61
 * @threadSafe
63
62
 */
64
63
public class ParseVersionMojo
65
64
    extends AbstractMojo
94
93
     * @throws MojoExecutionException if the plugin execution fails.
95
94
     */
96
95
    public void execute()
97
 
        throws MojoExecutionException
98
96
    {
99
 
 
100
97
        parseVersion (versionString, project.getProperties() );
101
 
 
102
98
    }
103
99
 
104
100
    /**
105
101
     * Parse a version String and add the components to a properties object.
106
102
     *
107
 
     * @param version
108
 
     * @param props
 
103
     * @param version the version to parse
 
104
     * @param props the target for the new properties
109
105
     */
110
106
    public void parseVersion( String version, Properties props)
111
107
    {
117
113
            getLog().debug("The version is not in the regular format, will try OSGi format instead");
118
114
            artifactVersion = new OsgiArtifactVersion( version );
119
115
        }
120
 
        props.setProperty( propertyPrefix + ".majorVersion", Integer.toString( artifactVersion.getMajorVersion() ) );
121
 
        props.setProperty( propertyPrefix + ".minorVersion", Integer.toString( artifactVersion.getMinorVersion() ) );
 
116
        props.setProperty( propertyPrefix + ".majorVersion", 
 
117
                           Integer.toString( artifactVersion.getMajorVersion() ) );
 
118
        props.setProperty( propertyPrefix + ".minorVersion", 
 
119
                           Integer.toString( artifactVersion.getMinorVersion() ) );
122
120
        props.setProperty( propertyPrefix + ".incrementalVersion",
123
121
                           Integer.toString( artifactVersion.getIncrementalVersion() ) );
124
122
 
 
123
        props.setProperty( propertyPrefix + ".nextMajorVersion", 
 
124
                           Integer.toString( artifactVersion.getMajorVersion() + 1 ) );
 
125
        props.setProperty( propertyPrefix + ".nextMinorVersion", 
 
126
                           Integer.toString( artifactVersion.getMinorVersion() + 1 ) );
 
127
        props.setProperty( propertyPrefix + ".nextIncrementalVersion",
 
128
                           Integer.toString( artifactVersion.getIncrementalVersion() + 1 ) );
 
129
 
125
130
        String qualifier = artifactVersion.getQualifier();
126
131
        if (qualifier == null)
127
132
        {