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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Version.COMPONENT dropVersionComponent
      Flag used to determine what components of the version will be used in OSGi version.
      protected org.apache.maven.project.MavenProject project
      The maven project.
      protected java.lang.String versionPropertyName  
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      OsgiVersionMojo()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute()  
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 java.lang.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