|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.maven.plugin.AbstractMojo
org.apache.maven.plugin.ide.AbstractIdeSupportMojo
Abstract base plugin which takes care of the common stuff usually needed by maven IDE plugins. A plugin extending
AbstractIdeSupportMojo should implement the setup()
and writeConfiguration()
methods, plus
the getters needed to get the various configuration flags and required components. The lifecycle:
*** calls setup() where you can configure your specific stuff and stop the mojo from execute if appropriate *** - manually resolve project dependencies, NOT failing if a dependency is missing - compute project references (reactor projects) if the getUseProjectReferences() flag is set - download sources/javadocs if the getDownloadSources() flag is set *** calls writeConfiguration(), passing the list of resolved referenced dependencies *** - report the list of missing sources or just tell how to turn this feature on if the flag was disabled
Field Summary | |
protected org.apache.maven.artifact.resolver.ArtifactCollector |
artifactCollector
Artifact collector, needed to resolve dependencies. |
protected org.apache.maven.artifact.factory.ArtifactFactory |
artifactFactory
Artifact factory, needed to download source jars for inclusion in classpath. |
protected org.apache.maven.artifact.metadata.ArtifactMetadataSource |
artifactMetadataSource
|
protected org.apache.maven.artifact.resolver.ArtifactResolver |
artifactResolver
Artifact resolver, needed to download source jars for inclusion in classpath. |
protected boolean |
downloadJavadocs
Enables/disables the downloading of javadoc attachments. |
protected boolean |
downloadSources
Enables/disables the downloading of source attachments. |
protected org.apache.maven.project.MavenProject |
executedProject
The currently executed project (can be a reactor project). |
protected boolean |
forceRecheck
Enables/disables the rechecking of the remote repository for downloading source/javadoc attachments. |
protected org.apache.maven.artifact.repository.ArtifactRepository |
localRepository
Local maven repository. |
protected org.codehaus.plexus.logging.Logger |
logger
Plexus logger needed for debugging manual artifact resolution. |
protected java.lang.String |
packaging
The project packaging. |
protected org.apache.maven.project.MavenProject |
project
The project whose project files to create. |
protected java.util.List |
reactorProjects
If the executed project is a reactor project, this will contains the full list of projects in the reactor. |
protected java.util.List |
remoteArtifactRepositories
Remote repositories which will be searched for source attachments. |
Fields inherited from interface org.apache.maven.plugin.Mojo |
ROLE |
Constructor Summary | |
AbstractIdeSupportMojo()
|
Method Summary | |
protected IdeDependency[] |
doDependencyResolution()
Resolve project dependencies. |
void |
enableLogging(org.codehaus.plexus.logging.Logger logger)
|
void |
execute()
|
org.apache.maven.artifact.factory.ArtifactFactory |
getArtifactFactory()
Getter for artifactFactory . |
org.apache.maven.artifact.metadata.ArtifactMetadataSource |
getArtifactMetadataSource()
Getter for artifactMetadataSource . |
org.apache.maven.artifact.resolver.ArtifactResolver |
getArtifactResolver()
Getter for artifactResolver . |
boolean |
getDownloadJavadocs()
Getter for downloadJavadocs . |
boolean |
getDownloadSources()
Getter for downloadSources . |
abstract java.util.List |
getExcludes()
|
org.apache.maven.project.MavenProject |
getExecutedProject()
Getter for executedProject . |
org.apache.maven.artifact.repository.ArtifactRepository |
getLocalRepository()
Getter for localRepository . |
org.apache.maven.project.MavenProject |
getProject()
Getter for project . |
abstract java.lang.String |
getProjectNameForArifact(org.apache.maven.artifact.Artifact artifact)
Find the name of the project as used in eclipse. |
protected org.apache.maven.project.MavenProject |
getReactorProject(org.apache.maven.artifact.Artifact artifact)
Checks the list of reactor projects to see if the artifact is included. |
java.util.List |
getReactorProjects()
Getter for reactorProjects . |
java.util.List |
getRemoteArtifactRepositories()
Getter for remoteArtifactRepositories . |
protected abstract boolean |
getUseProjectReferences()
return false if projects available in a reactor build should be considered normal dependencies,
true if referenced project will be linked and not need artifact resolution. |
protected IdeDependency[] |
getWorkspaceArtefacts()
|
protected boolean |
hasToResolveJar(org.apache.maven.artifact.Artifact art)
Checks if jar has to be resolved for the given artifact |
protected boolean |
isAvailableAsAReactorProject(org.apache.maven.artifact.Artifact artifact)
Utility method that locates a project producing the given artifact. |
protected boolean |
isMavenVersion(java.lang.String version)
Checks whether the currently running Maven satisfies the specified version (range). |
protected boolean |
isResolveDependencies()
|
void |
setArtifactFactory(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory)
Setter for artifactFactory . |
void |
setArtifactMetadataSource(org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource)
Setter for artifactMetadataSource . |
void |
setArtifactResolver(org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver)
Setter for artifactResolver . |
void |
setDownloadJavadocs(boolean downloadJavadoc)
Setter for downloadJavadocs . |
void |
setDownloadSources(boolean downloadSources)
Setter for downloadSources . |
void |
setExecutedProject(org.apache.maven.project.MavenProject executedProject)
Setter for executedProject . |
void |
setLocalRepository(org.apache.maven.artifact.repository.ArtifactRepository localRepository)
Setter for localRepository . |
void |
setProject(org.apache.maven.project.MavenProject project)
Setter for project . |
void |
setReactorProjects(java.util.List reactorProjects)
Setter for reactorProjects . |
void |
setRemoteArtifactRepositories(java.util.List remoteArtifactRepositories)
Setter for remoteArtifactRepositories . |
protected void |
setResolveDependencies(boolean resolveDependencies)
|
protected abstract boolean |
setup()
Hook for preparation steps before the actual plugin execution. |
protected boolean |
useProjectReference(org.apache.maven.artifact.Artifact art)
Checks if a projects reference has to be used for the given artifact |
protected abstract void |
writeConfiguration(IdeDependency[] deps)
Main plugin method where dependencies should be processed in order to generate IDE configuration files. |
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 |
protected org.apache.maven.project.MavenProject project
protected org.apache.maven.project.MavenProject executedProject
protected java.lang.String packaging
protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
protected org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
protected org.apache.maven.artifact.resolver.ArtifactCollector artifactCollector
protected org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
protected java.util.List remoteArtifactRepositories
protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
protected java.util.List reactorProjects
protected boolean downloadSources
true
remote repositories are checked for sources: in order to avoid repeated check for unavailable source archives, a
status cache is mantained. To reset this cache run mvn eclipse:remove-cache
, or use the
forceRecheck
option.
protected boolean downloadJavadocs
true
remote repositories are checked for javadocs: in order to avoid repeated check for unavailable javadoc archives,
a status cache is mantained. To reset this cache run mvn eclipse:remove-cache
, or use the
forceRecheck
option.
protected boolean forceRecheck
true
and the source or javadoc attachment has a status cache to indicate
that it is not available, then the remote repository will be rechecked for a source or javadoc attachment and the
status cache updated to reflect the new state.
protected org.codehaus.plexus.logging.Logger logger
Constructor Detail |
public AbstractIdeSupportMojo()
Method Detail |
public org.apache.maven.artifact.metadata.ArtifactMetadataSource getArtifactMetadataSource()
artifactMetadataSource
.
public void setArtifactMetadataSource(org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource)
artifactMetadataSource
.
artifactMetadataSource
- The artifactMetadataSource to set.public org.apache.maven.project.MavenProject getProject()
project
.
public void setProject(org.apache.maven.project.MavenProject project)
project
.
project
- The project to set.public java.util.List getReactorProjects()
reactorProjects
.
public void setReactorProjects(java.util.List reactorProjects)
reactorProjects
.
reactorProjects
- The reactorProjects to set.public java.util.List getRemoteArtifactRepositories()
remoteArtifactRepositories
.
public void setRemoteArtifactRepositories(java.util.List remoteArtifactRepositories)
remoteArtifactRepositories
.
remoteArtifactRepositories
- The remoteArtifactRepositories to set.public org.apache.maven.artifact.factory.ArtifactFactory getArtifactFactory()
artifactFactory
.
public void setArtifactFactory(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory)
artifactFactory
.
artifactFactory
- The artifactFactory to set.public org.apache.maven.artifact.resolver.ArtifactResolver getArtifactResolver()
artifactResolver
.
public void setArtifactResolver(org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver)
artifactResolver
.
artifactResolver
- The artifactResolver to set.public org.apache.maven.project.MavenProject getExecutedProject()
executedProject
.
public void setExecutedProject(org.apache.maven.project.MavenProject executedProject)
executedProject
.
executedProject
- The executedProject to set.public org.apache.maven.artifact.repository.ArtifactRepository getLocalRepository()
localRepository
.
public void setLocalRepository(org.apache.maven.artifact.repository.ArtifactRepository localRepository)
localRepository
.
localRepository
- The localRepository to set.public boolean getDownloadJavadocs()
downloadJavadocs
.
public void setDownloadJavadocs(boolean downloadJavadoc)
downloadJavadocs
.
downloadJavadoc
- The downloadJavadocs to set.public boolean getDownloadSources()
downloadSources
.
public void setDownloadSources(boolean downloadSources)
downloadSources
.
downloadSources
- The downloadSources to set.protected void setResolveDependencies(boolean resolveDependencies)
protected boolean isResolveDependencies()
protected abstract boolean getUseProjectReferences()
false
if projects available in a reactor build should be considered normal dependencies,
true
if referenced project will be linked and not need artifact resolution.
true
if referenced project will be linked and not need artifact resolutionprotected abstract boolean setup() throws org.apache.maven.plugin.MojoExecutionException
true
if execution should continue or false
if not.
org.apache.maven.plugin.MojoExecutionException
- generic mojo exceptionprotected abstract void writeConfiguration(IdeDependency[] deps) throws org.apache.maven.plugin.MojoExecutionException
deps
- list of IdeDependency
objects, with artifacts, sources and javadocs already resolved
org.apache.maven.plugin.MojoExecutionException
- generic mojo exceptionpublic void enableLogging(org.codehaus.plexus.logging.Logger logger)
enableLogging
in interface org.codehaus.plexus.logging.LogEnabled
LogEnabled.enableLogging(org.codehaus.plexus.logging.Logger)
public final void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
execute
in interface org.apache.maven.plugin.Mojo
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
Mojo.execute()
protected IdeDependency[] doDependencyResolution() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
- if dependencies can't be resolvedpublic abstract java.lang.String getProjectNameForArifact(org.apache.maven.artifact.Artifact artifact)
artifact
- The artifact to find the eclipse name for.
protected boolean isAvailableAsAReactorProject(org.apache.maven.artifact.Artifact artifact)
artifact
- the artifact a project should produce.
true
if the artifact is produced by a reactor projectart.protected org.apache.maven.project.MavenProject getReactorProject(org.apache.maven.artifact.Artifact artifact)
artifact
- the artifact to check if it is in the reactor
protected IdeDependency[] getWorkspaceArtefacts()
public abstract java.util.List getExcludes()
protected boolean hasToResolveJar(org.apache.maven.artifact.Artifact art)
art
- the artifact to check
protected boolean useProjectReference(org.apache.maven.artifact.Artifact art)
art
- the artifact to check
protected boolean isMavenVersion(java.lang.String version)
version
- The version range to test for, must not be null
.
true
if the current Maven version matches the specified version range, false
otherwise.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |