Class OsgiVersionMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    public class OsgiVersionMojo
    extends org.apache.maven.plugin.AbstractMojo
    Converts the project version into the OSGi format and set that to "project.osgi.version" property. It can be configured to drop certain portions from the version. See dropVersionComponent.
    Author:
    Kohsuke Kawaguchi, Sanjeeb.Sahoo@Sun.COM
    • Field Detail

      • project

        protected org.apache.maven.project.MavenProject project
        The maven project.
      • dropVersionComponent

        protected Version.COMPONENT dropVersionComponent
        Flag used to determine what components of the version will be used in OSGi version. An OSGi version has four parts as shown below: major.minor.micro.qualifer. It is not always desirable to use all four parts while exporting packages. In fact, maven version and OSGi version behave just opposite during version comparison as shown below: a maven version 1.2.3-SNAPSHOT is mapped to OSGi version 1.2.3.SNAPSHOT. In maven, 1.2.3 > 1.2.3-SNAPSHOT, but in OSGi, 1.2.3 < 1.2.3.SNAPSHOT. So, it is highly desirable to drop qualifier while computing the version. Instead of hardcoding the policy, we let user tell us what portions will be used in the OSGi version. If they ask us to drop minor, then only major will be used. Similarly, if they ask us to drop qualifier, then major, minor and micro portions will be used.
      • versionPropertyName

        protected String versionPropertyName
    • Constructor Detail

      • OsgiVersionMojo

        public OsgiVersionMojo()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException,
                            org.apache.maven.plugin.MojoFailureException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
        org.apache.maven.plugin.MojoFailureException