org.apache.maven.plugin.eclipse
Class EclipseToMavenMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.eclipse.EclipseToMavenMojo
All Implemented Interfaces:
ContextEnabled, Mojo, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
Direct Known Subclasses:
MakeArtifactsMojo

public class EclipseToMavenMojo
extends AbstractMojo
implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable

Add eclipse artifacts from an eclipse installation to the local repo. This mojo automatically analize the eclipse directory, copy plugins jars to the local maven repo, and generates appropriate poms. This is the official central repository builder for Eclipse plugins, so it has the necessary default values. For customized repositories see MakeArtifactsMojo Typical usage: mvn eclipse:to-maven -DdeployTo=maven.org::default::scpexe://repo1.maven.org/home/maven/repository-staging/to-ibiblio/eclipse-staging -DeclipseDir=.

Version:
$Id: EclipseToMavenMojo.java 1154368 2011-08-05 20:13:42Z rfscholte $
Author:
Fabrizio Giustina, Carlos Sanchez
Is defined by the goal name:
to-maven
Requires a Maven project to run:
false

Field Summary
protected  org.codehaus.plexus.components.interactivity.InputHandler inputHandler
          Input handler, needed for comand line handling.
protected  ArtifactInstaller installer
          ArtifactInstaller component.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
EclipseToMavenMojo()
           
 
Method Summary
 void contextualize(org.codehaus.plexus.context.Context context)
          
protected  String createArtifactId(String bundleName)
          Get the artifact id as the tokens after last dot e.g.
protected  String createGroupId(String bundleName)
          Get the group id as the tokens until last dot e.g.
 void execute()
           
protected  String fixBuildNumberSeparator(String versionRange)
          Fix the separator for the 4th token in a versions.
protected  String getKey(Model model)
           
protected  String osgiVersionToMavenVersion(String version)
           
protected  String osgiVersionToMavenVersion(String version, String forcedQualifier, boolean stripQualifier)
          The 4th (build) token MUST be separed with "-" and not with "." in maven.
protected  Dependency[] parseDependencies(String requireBundle)
          Parses the "Require-Bundle" and convert it to a list of dependencies.
protected  void processFile(File file, Map plugins, Map models)
           
protected  void processPlugin(EclipseOsgiPlugin plugin, Model model, Map plugins, Map models)
           
protected  void resolveVersionRanges(Model model, Map models)
          Resolve version ranges in the model provided, overriding version ranges with versions from the dependency in the provided map of models.
 
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

installer

protected ArtifactInstaller installer
ArtifactInstaller component.

Is a Plexus component defined by:

inputHandler

protected org.codehaus.plexus.components.interactivity.InputHandler inputHandler
Input handler, needed for comand line handling.

Is a Plexus component defined by:
Constructor Detail

EclipseToMavenMojo

public EclipseToMavenMojo()
Method Detail

execute

public void execute()
             throws MojoExecutionException,
                    MojoFailureException
Specified by:
execute in interface Mojo
Throws:
MojoExecutionException
MojoFailureException
See Also:
Mojo.execute()

processFile

protected void processFile(File file,
                           Map plugins,
                           Map models)
                    throws MojoExecutionException,
                           MojoFailureException
Throws:
MojoExecutionException
MojoFailureException

processPlugin

protected void processPlugin(EclipseOsgiPlugin plugin,
                             Model model,
                             Map plugins,
                             Map models)
                      throws MojoExecutionException,
                             MojoFailureException
Throws:
MojoExecutionException
MojoFailureException

getKey

protected String getKey(Model model)

resolveVersionRanges

protected void resolveVersionRanges(Model model,
                                    Map models)
                             throws MojoFailureException
Resolve version ranges in the model provided, overriding version ranges with versions from the dependency in the provided map of models. TODO doesn't check if the version is in range, it just overwrites it

Parameters:
model -
models -
Throws:
MojoFailureException

osgiVersionToMavenVersion

protected String osgiVersionToMavenVersion(String version)

osgiVersionToMavenVersion

protected String osgiVersionToMavenVersion(String version,
                                           String forcedQualifier,
                                           boolean stripQualifier)
The 4th (build) token MUST be separed with "-" and not with "." in maven. A version with 4 dots is not parsed, and the whole string is considered a qualifier. See tests in DefaultArtifactVersion for reference.

Parameters:
version - initial version
forcedQualifier - build number
stripQualifier - always remove 4th token in version
Returns:
converted version

contextualize

public void contextualize(org.codehaus.plexus.context.Context context)
                   throws org.codehaus.plexus.context.ContextException

Specified by:
contextualize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
Throws:
org.codehaus.plexus.context.ContextException

createGroupId

protected String createGroupId(String bundleName)
Get the group id as the tokens until last dot e.g. org.eclipse.jdt -> org.eclipse

Parameters:
bundleName - bundle name
Returns:
group id

createArtifactId

protected String createArtifactId(String bundleName)
Get the artifact id as the tokens after last dot e.g. org.eclipse.jdt -> jdt

Parameters:
bundleName - bundle name
Returns:
artifact id

parseDependencies

protected Dependency[] parseDependencies(String requireBundle)
Parses the "Require-Bundle" and convert it to a list of dependencies.

Parameters:
requireBundle - "Require-Bundle" entry
Returns:
an array of Dependency

fixBuildNumberSeparator

protected String fixBuildNumberSeparator(String versionRange)
Fix the separator for the 4th token in a versions. In maven this must be "-", in OSGI it's "."

Parameters:
versionRange - input range
Returns:
modified version range


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.