Package org.apache.maven.plugin.idea
Class IdeaModuleMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugin.idea.AbstractIdeaMojo
-
- org.apache.maven.plugin.idea.IdeaModuleMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
public class IdeaModuleMojo extends AbstractIdeaMojo
Creates the module files (*.iml) for IntelliJ IDEA.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.MapattemptedDownloadsA temporary cache of artifacts that's already been downloaded or attempted to be downloaded.private booleandependenciesAsLibrariesCauses the module libraries to use a short name for all dependencies.private java.lang.StringdeploymentDescriptorFileSpecify the location of the deployment descriptor file, if one is provided.private booleandownloadJavadocsEnables/disables the downloading of javadoc attachments.private booleandownloadSourcesEnables/disables the downloading of source attachments.private java.lang.StringexcludeA comma-separated list of directories that should be excluded.private booleanideaPluginTell IntelliJ IDEA that this module is an IntelliJ IDEA Plugin.private java.lang.StringideaVersionSpecify the version of IDEA to target.private java.lang.StringjavadocClassifierSets the classifier string attached to an artifact javadoc archive name.private Library[]librariesAn optional set of Library objects that allow you to specify a comma separated list of source dirs, class dirs, or to indicate that the library should be excluded from the module.private booleanlinkModulesWhether to link the reactor projects as dependency modules or as libraries.private java.util.Setmacrosprivate java.util.ListreactorProjectsThe reactor projects in a multi-module build.private java.lang.StringsourceClassifierSets the classifier string attached to an artifact source archive name.private booleanuseFullNamesWhether to use full artifact names when referencing libraries.private org.apache.maven.artifact.manager.WagonManagerwagonManager-
Fields inherited from class org.apache.maven.plugin.idea.AbstractIdeaMojo
artifactFactory, artifactMetadataSource, artifactResolver, executedProject, localRepo, log, overwrite
-
-
Constructor Summary
Constructors Constructor Description IdeaModuleMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.dom4j.ElementaddDeploymentDescriptor(org.dom4j.Element component, java.lang.String name, java.lang.String version, java.lang.String file)private voidaddEarModule(org.dom4j.Element module)private voidaddEjbModule(org.dom4j.Element module)private voidaddExcludeFolder(org.dom4j.Element content, java.lang.String directory)private voidaddPluginModule(org.dom4j.Element module)private voidaddSourceFolder(org.dom4j.Element content, java.lang.String directory, boolean isTest)Adds a sourceFolder element to IDEA (.iml) project fileprivate voidaddWebModule(org.dom4j.Element module)Adds the Web module to the (.iml) project file.private org.dom4j.ElementcreateOrGetElement(org.dom4j.Element lib, java.lang.String name)voidexecute()Create IDEA (.iml) project files.private voidextractMacro(java.lang.String path)private LibraryfindLibrary(org.apache.maven.artifact.Artifact a)private org.dom4j.ElementfindSetting(org.dom4j.Element component, java.lang.String name)Returns an Xpp3Dom element (setting).private java.util.ListgetExcludedDirectories(java.io.File target, java.util.List excludeList, java.util.List sourceFolders)private java.lang.StringgetLibraryUrl(org.apache.maven.artifact.Artifact artifact)private java.lang.StringgetModuleFileUrl(java.io.File basedir, java.lang.String path)Translate the relative path of the file into module pathprivate java.lang.StringgetModuleFileUrl(java.lang.String file)voidinitParam(org.apache.maven.project.MavenProject project, org.apache.maven.artifact.factory.ArtifactFactory artifactFactory, org.apache.maven.artifact.repository.ArtifactRepository localRepo, org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver, org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource, org.apache.maven.plugin.logging.Log log, boolean overwrite, org.apache.maven.project.MavenProject executedProject, java.util.List reactorProjects, org.apache.maven.artifact.manager.WagonManager wagonManager, boolean linkModules, boolean useFullNames, boolean downloadSources, java.lang.String sourceClassifier, boolean downloadJavadocs, java.lang.String javadocClassifier, Library[] libraries, java.util.Set macros, java.lang.String exclude, boolean useShortDependencyNames, java.lang.String deploymentDescriptorFile, boolean ideaPlugin, java.lang.String ideaVersion)private booleanisReactorProject(java.lang.String groupId, java.lang.String artifactId)private java.lang.StringresolveClassifiedArtifact(org.apache.maven.artifact.Artifact artifact, java.lang.String classifier)private voidresolveClassifier(org.dom4j.Element element, org.apache.maven.artifact.Artifact a, java.lang.String classifier)private voidrewriteDependencies(org.dom4j.Element component)voidrewriteModule()-
Methods inherited from class org.apache.maven.plugin.idea.AbstractIdeaMojo
convertDriveLetter, createElement, doDependencyResolution, findComponent, findElement, findElement, getLog, getPluginSetting, initParam, readXmlDocument, removeOldElements, toRelative, writeXmlDocument
-
-
-
-
Field Detail
-
reactorProjects
private java.util.List reactorProjects
The reactor projects in a multi-module build.
-
wagonManager
private org.apache.maven.artifact.manager.WagonManager wagonManager
-
linkModules
private boolean linkModules
Whether to link the reactor projects as dependency modules or as libraries.
-
deploymentDescriptorFile
private java.lang.String deploymentDescriptorFile
Specify the location of the deployment descriptor file, if one is provided.
-
useFullNames
private boolean useFullNames
Whether to use full artifact names when referencing libraries.
-
downloadSources
private boolean downloadSources
Enables/disables the downloading of source attachments.
-
downloadJavadocs
private boolean downloadJavadocs
Enables/disables the downloading of javadoc attachments.
-
sourceClassifier
private java.lang.String sourceClassifier
Sets the classifier string attached to an artifact source archive name.
-
javadocClassifier
private java.lang.String javadocClassifier
Sets the classifier string attached to an artifact javadoc archive name.
-
libraries
private Library[] libraries
An optional set of Library objects that allow you to specify a comma separated list of source dirs, class dirs, or to indicate that the library should be excluded from the module. For example:<libraries> <library> <name>webwork</name> <sources>file://$webwork$/src/java</sources> <!-- <classes>...</classes> <exclude>true</exclude> --> </library> </libraries>
-
exclude
private java.lang.String exclude
A comma-separated list of directories that should be excluded. These directories are in addition to those already excluded, such as target.
-
dependenciesAsLibraries
private boolean dependenciesAsLibraries
Causes the module libraries to use a short name for all dependencies. This is very convenient but has been reported to cause problems with IDEA.
-
attemptedDownloads
private static java.util.Map attemptedDownloads
A temporary cache of artifacts that's already been downloaded or attempted to be downloaded. This is to refrain from trying to download a dependency that we have already tried to download.
-
ideaPlugin
private boolean ideaPlugin
Tell IntelliJ IDEA that this module is an IntelliJ IDEA Plugin.
-
ideaVersion
private java.lang.String ideaVersion
Specify the version of IDEA to target. This is needed to identify the default formatting of project-jdk-name used by IDEA. Currently supports 4.x and 5.x. This will only be used when parameter jdkName is not set.
-
macros
private java.util.Set macros
-
-
Method Detail
-
initParam
public void initParam(org.apache.maven.project.MavenProject project, org.apache.maven.artifact.factory.ArtifactFactory artifactFactory, org.apache.maven.artifact.repository.ArtifactRepository localRepo, org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver, org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource, org.apache.maven.plugin.logging.Log log, boolean overwrite, org.apache.maven.project.MavenProject executedProject, java.util.List reactorProjects, org.apache.maven.artifact.manager.WagonManager wagonManager, boolean linkModules, boolean useFullNames, boolean downloadSources, java.lang.String sourceClassifier, boolean downloadJavadocs, java.lang.String javadocClassifier, Library[] libraries, java.util.Set macros, java.lang.String exclude, boolean useShortDependencyNames, java.lang.String deploymentDescriptorFile, boolean ideaPlugin, java.lang.String ideaVersion)
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionExceptionCreate IDEA (.iml) project files.- Throws:
org.apache.maven.plugin.MojoExecutionException
-
rewriteModule
public void rewriteModule() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
rewriteDependencies
private void rewriteDependencies(org.dom4j.Element component)
-
createOrGetElement
private org.dom4j.Element createOrGetElement(org.dom4j.Element lib, java.lang.String name)
-
addEarModule
private void addEarModule(org.dom4j.Element module)
-
addEjbModule
private void addEjbModule(org.dom4j.Element module)
-
extractMacro
private void extractMacro(java.lang.String path)
-
findLibrary
private Library findLibrary(org.apache.maven.artifact.Artifact a)
-
getExcludedDirectories
private java.util.List getExcludedDirectories(java.io.File target, java.util.List excludeList, java.util.List sourceFolders)
-
addWebModule
private void addWebModule(org.dom4j.Element module)
Adds the Web module to the (.iml) project file.- Parameters:
module- Xpp3Dom element
-
addPluginModule
private void addPluginModule(org.dom4j.Element module)
-
getModuleFileUrl
private java.lang.String getModuleFileUrl(java.io.File basedir, java.lang.String path)Translate the relative path of the file into module path- Parameters:
basedir- File to use as basedirpath- Absolute path string to translate to ModuleFileUrl- Returns:
- moduleFileUrl Translated Module File URL
-
getModuleFileUrl
private java.lang.String getModuleFileUrl(java.lang.String file)
-
addSourceFolder
private void addSourceFolder(org.dom4j.Element content, java.lang.String directory, boolean isTest)Adds a sourceFolder element to IDEA (.iml) project file- Parameters:
content- Xpp3Dom elementdirectory- Directory to set as url.isTest- True if directory isTestSource.
-
addExcludeFolder
private void addExcludeFolder(org.dom4j.Element content, java.lang.String directory)
-
isReactorProject
private boolean isReactorProject(java.lang.String groupId, java.lang.String artifactId)
-
resolveClassifier
private void resolveClassifier(org.dom4j.Element element, org.apache.maven.artifact.Artifact a, java.lang.String classifier)
-
resolveClassifiedArtifact
private java.lang.String resolveClassifiedArtifact(org.apache.maven.artifact.Artifact artifact, java.lang.String classifier)
-
findSetting
private org.dom4j.Element findSetting(org.dom4j.Element component, java.lang.String name)Returns an Xpp3Dom element (setting).- Parameters:
component- Xpp3Dom elementname- Setting attribute to find- Returns:
- setting Xpp3Dom element
-
getLibraryUrl
private java.lang.String getLibraryUrl(org.apache.maven.artifact.Artifact artifact)
-
addDeploymentDescriptor
private org.dom4j.Element addDeploymentDescriptor(org.dom4j.Element component, java.lang.String name, java.lang.String version, java.lang.String file)
-
-