com.sun.enterprise.module.maven
Class OsgiVersionMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by com.sun.enterprise.module.maven.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 Summary
protected  org.apache.maven.shared.osgi.Maven2OsgiConverter converter
           
protected  String 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  String versionPropertyName
           
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
OsgiVersionMojo()
           
 
Method Summary
 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 String 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

converter

protected org.apache.maven.shared.osgi.Maven2OsgiConverter converter
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


Copyright © 2013 Oracle Corporation. All Rights Reserved.