public class EclipseToMavenMojo
extends org.apache.maven.plugin.AbstractMojo
implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
MakeArtifactsMojo Typical usage:
mvn eclipse:to-maven -DdeployTo=maven.org::default::scpexe://repo1.maven.org/home/maven/repository-staging/to-ibiblio/eclipse-staging -DeclipseDir=.| Modifier and Type | Field and Description |
|---|---|
private org.apache.maven.artifact.factory.ArtifactFactory |
artifactFactory
ArtifactFactory component.
|
private org.apache.maven.artifact.repository.ArtifactRepositoryFactory |
artifactRepositoryFactory
ArtifactRepositoryFactory component.
|
private org.codehaus.plexus.PlexusContainer |
container
Plexus container, needed to manually lookup components for deploy of artifacts.
|
private org.apache.maven.artifact.deployer.ArtifactDeployer |
deployer
ArtifactDeployer component.
|
private java.lang.String |
deployTo
Specifies a remote repository to which generated artifacts should be deployed to.
|
private static java.util.regex.Pattern |
DEPLOYTO_PATTERN
A pattern the
deployTo param should match. |
private java.io.File |
eclipseDir
Eclipse installation dir.
|
protected org.codehaus.plexus.components.interactivity.InputHandler |
inputHandler
Input handler, needed for comand line handling.
|
protected org.apache.maven.artifact.installer.ArtifactInstaller |
installer
ArtifactInstaller component.
|
private org.apache.maven.artifact.repository.ArtifactRepository |
localRepository
Local maven repository.
|
private boolean |
stripQualifier
Strip qualifier (fourth token) from the plugin version.
|
private static java.util.regex.Pattern |
VERSION_PATTERN
A pattern for a 4 digit osgi version number.
|
| Constructor and Description |
|---|
EclipseToMavenMojo() |
| Modifier and Type | Method and Description |
|---|---|
void |
contextualize(org.codehaus.plexus.context.Context context) |
protected java.lang.String |
createArtifactId(java.lang.String bundleName)
Get the artifact id as the tokens after last dot e.g.
|
protected java.lang.String |
createGroupId(java.lang.String bundleName)
Get the group id as the tokens until last dot e.g.
|
private org.apache.maven.model.Model |
createModel(EclipseOsgiPlugin plugin)
Create the
Model from a plugin manifest |
void |
execute() |
protected java.lang.String |
fixBuildNumberSeparator(java.lang.String versionRange)
Fix the separator for the 4th token in a versions.
|
private EclipseOsgiPlugin |
getEclipsePlugin(java.io.File file)
Get a
EclipseOsgiPlugin object from a plugin jar/dir found in the target dir. |
private java.lang.String |
getKey(org.apache.maven.model.Dependency dependency) |
protected java.lang.String |
getKey(org.apache.maven.model.Model model) |
protected java.lang.String |
osgiVersionToMavenVersion(java.lang.String version) |
protected java.lang.String |
osgiVersionToMavenVersion(java.lang.String version,
java.lang.String forcedQualifier,
boolean stripQualifier)
The 4th (build) token MUST be separed with "-" and not with "." in maven.
|
protected org.apache.maven.model.Dependency[] |
parseDependencies(java.lang.String requireBundle)
Parses the "Require-Bundle" and convert it to a list of dependencies.
|
protected void |
processFile(java.io.File file,
java.util.Map plugins,
java.util.Map models) |
protected void |
processPlugin(EclipseOsgiPlugin plugin,
org.apache.maven.model.Model model,
java.util.Map plugins,
java.util.Map models) |
private org.apache.maven.artifact.repository.ArtifactRepository |
resolveRemoteRepo()
Resolves the deploy
deployTo parameter to an ArtifactRepository instance (if set). |
protected void |
resolveVersionRanges(org.apache.maven.model.Model model,
java.util.Map models)
Resolve version ranges in the model provided, overriding version ranges with versions from the dependency in the
provided map of models.
|
private void |
writeArtifact(EclipseOsgiPlugin plugin,
org.apache.maven.model.Model model,
org.apache.maven.artifact.repository.ArtifactRepository remoteRepo)
Writes the artifact to the repo
|
private static final java.util.regex.Pattern DEPLOYTO_PATTERN
deployTo param should match.private static final java.util.regex.Pattern VERSION_PATTERN
private org.codehaus.plexus.PlexusContainer container
private org.apache.maven.artifact.repository.ArtifactRepository localRepository
private org.apache.maven.artifact.repository.ArtifactRepositoryFactory artifactRepositoryFactory
private org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
protected org.apache.maven.artifact.installer.ArtifactInstaller installer
private org.apache.maven.artifact.deployer.ArtifactDeployer deployer
private java.io.File eclipseDir
protected org.codehaus.plexus.components.interactivity.InputHandler inputHandler
private boolean stripQualifier
3.2 can be named org.eclipse.core.filesystem_1.0.0.v20060603.jar. It's usually
handy to not to include this qualifier when generating maven artifacts for major releases, while it's needed when
working with eclipse integration/nightly builds.private java.lang.String deployTo
id::layout::urlpublic void execute()
throws org.apache.maven.plugin.MojoExecutionException,
org.apache.maven.plugin.MojoFailureException
execute in interface org.apache.maven.plugin.Mojoorg.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureExceptionMojo.execute()protected void processFile(java.io.File file,
java.util.Map plugins,
java.util.Map models)
throws org.apache.maven.plugin.MojoExecutionException,
org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureExceptionprotected void processPlugin(EclipseOsgiPlugin plugin, org.apache.maven.model.Model model, java.util.Map plugins, java.util.Map models) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureExceptionprotected java.lang.String getKey(org.apache.maven.model.Model model)
private java.lang.String getKey(org.apache.maven.model.Dependency dependency)
protected void resolveVersionRanges(org.apache.maven.model.Model model,
java.util.Map models)
throws org.apache.maven.plugin.MojoFailureException
model - models - org.apache.maven.plugin.MojoFailureExceptionprivate EclipseOsgiPlugin getEclipsePlugin(java.io.File file) throws org.apache.maven.plugin.MojoExecutionException
EclipseOsgiPlugin object from a plugin jar/dir found in the target dir.file - plugin jar or dirorg.apache.maven.plugin.MojoExecutionException - if anything bad happens while parsing filesprivate org.apache.maven.model.Model createModel(EclipseOsgiPlugin plugin) throws org.apache.maven.plugin.MojoExecutionException
Model from a plugin manifestplugin - Eclipse plugin jar or dirorg.apache.maven.plugin.MojoExecutionException - if anything bad happens while parsing filesprivate void writeArtifact(EclipseOsgiPlugin plugin, org.apache.maven.model.Model model, org.apache.maven.artifact.repository.ArtifactRepository remoteRepo) throws org.apache.maven.plugin.MojoExecutionException
model - remoteRepo - remote repository (if set)org.apache.maven.plugin.MojoExecutionExceptionprotected java.lang.String osgiVersionToMavenVersion(java.lang.String version)
protected java.lang.String osgiVersionToMavenVersion(java.lang.String version,
java.lang.String forcedQualifier,
boolean stripQualifier)
version - initial versionforcedQualifier - build numberstripQualifier - always remove 4th token in versionprivate org.apache.maven.artifact.repository.ArtifactRepository resolveRemoteRepo()
throws org.apache.maven.plugin.MojoFailureException,
org.apache.maven.plugin.MojoExecutionException
deployTo parameter to an ArtifactRepository instance (if set).deployTo is not set.org.apache.maven.plugin.MojoFailureExceptionorg.apache.maven.plugin.MojoExecutionExceptionpublic void contextualize(org.codehaus.plexus.context.Context context)
throws org.codehaus.plexus.context.ContextException
contextualize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizableorg.codehaus.plexus.context.ContextExceptionprotected java.lang.String createGroupId(java.lang.String bundleName)
org.eclipse.jdt -> org.eclipsebundleName - bundle nameprotected java.lang.String createArtifactId(java.lang.String bundleName)
org.eclipse.jdt -> jdtbundleName - bundle nameprotected org.apache.maven.model.Dependency[] parseDependencies(java.lang.String requireBundle)
requireBundle - "Require-Bundle" entryDependencyprotected java.lang.String fixBuildNumberSeparator(java.lang.String versionRange)
versionRange - input range