org.apache.maven.plugin.idea
Class AbstractIdeaMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.idea.AbstractIdeaMojo
All Implemented Interfaces:
ContextEnabled, Mojo
Direct Known Subclasses:
IdeaModuleMojo, IdeaMojo, IdeaProjectMojo, IdeaWorkspaceMojo

public abstract class AbstractIdeaMojo
extends AbstractMojo

Author:
Edwin Punzalan

Field Summary
protected  org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
           
protected  ArtifactMetadataSource artifactMetadataSource
           
protected  ArtifactResolver artifactResolver
           
protected  MavenProject executedProject
          The Maven Project.
protected  ArtifactRepository localRepo
           
protected  Log log
           
protected  boolean overwrite
          Whether to update the existing project files or overwrite them.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractIdeaMojo()
           
 
Method Summary
protected  org.dom4j.Element createElement(org.dom4j.Element module, String name)
          Creates an Xpp3Dom element.
protected  void doDependencyResolution(MavenProject project, ArtifactRepository localRepo)
           
protected  org.dom4j.Element findComponent(org.dom4j.Element module, String name)
          Finds element from the module element.
protected  org.dom4j.Element findElement(org.dom4j.Element component, String name)
           
protected  org.dom4j.Element findElement(org.dom4j.Element element, String elementName, String attributeName)
           
 Log getLog()
           
protected  String getPluginSetting(String artifactId, String optionName, String defaultValue)
           
 void initParam(MavenProject project, org.apache.maven.artifact.factory.ArtifactFactory artifactFactory, ArtifactRepository localRepo, ArtifactResolver artifactResolver, ArtifactMetadataSource artifactMetadataSource, Log log, boolean overwrite)
           
protected  org.dom4j.Document readXmlDocument(File file, String altFilename)
           
protected  void removeOldElements(org.dom4j.Element content, String name)
          Remove elements from content (Xpp3Dom).
protected  String toRelative(String basedir, String absolutePath)
          Translate the absolutePath into its relative path.
protected  void writeXmlDocument(File file, org.dom4j.Document document)
           
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.maven.plugin.Mojo
execute
 

Field Detail

executedProject

protected MavenProject executedProject
The Maven Project.

Is defined by:
expression:
${executedProject}
Is required.
Is readonly.

log

protected Log log

overwrite

protected boolean overwrite
Whether to update the existing project files or overwrite them.

Is defined by:
expression:
${overwrite}
default-value:
false

artifactFactory

protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
Is a Plexus component defined by:

localRepo

protected ArtifactRepository localRepo
Is defined by:
expression:
${localRepository}
Is required.
Is readonly.

artifactResolver

protected ArtifactResolver artifactResolver
Is a Plexus component defined by:

artifactMetadataSource

protected ArtifactMetadataSource artifactMetadataSource
Is a Plexus component defined by:
role:
org.apache.maven.artifact.metadata.ArtifactMetadataSource
hint:
maven
Constructor Detail

AbstractIdeaMojo

public AbstractIdeaMojo()
Method Detail

initParam

public void initParam(MavenProject project,
                      org.apache.maven.artifact.factory.ArtifactFactory artifactFactory,
                      ArtifactRepository localRepo,
                      ArtifactResolver artifactResolver,
                      ArtifactMetadataSource artifactMetadataSource,
                      Log log,
                      boolean overwrite)

readXmlDocument

protected org.dom4j.Document readXmlDocument(File file,
                                             String altFilename)
                                      throws org.dom4j.DocumentException
Throws:
org.dom4j.DocumentException

writeXmlDocument

protected void writeXmlDocument(File file,
                                org.dom4j.Document document)
                         throws IOException
Throws:
IOException

findComponent

protected org.dom4j.Element findComponent(org.dom4j.Element module,
                                          String name)
Finds element from the module element.

Parameters:
module - Xpp3Dom element
name - Name attribute to find
Returns:
component Returns the Xpp3Dom element found.

findElement

protected org.dom4j.Element findElement(org.dom4j.Element element,
                                        String elementName,
                                        String attributeName)

findElement

protected org.dom4j.Element findElement(org.dom4j.Element component,
                                        String name)

createElement

protected org.dom4j.Element createElement(org.dom4j.Element module,
                                          String name)
Creates an Xpp3Dom element.

Parameters:
module - Xpp3Dom element
name - Name of the element
Returns:
component Xpp3Dom element

toRelative

protected String toRelative(String basedir,
                            String absolutePath)
Translate the absolutePath into its relative path.

Parameters:
basedir - The basedir of the project.
absolutePath - The absolute path that must be translated to relative path.
Returns:
relative Relative path of the parameter absolute path.

removeOldElements

protected void removeOldElements(org.dom4j.Element content,
                                 String name)
Remove elements from content (Xpp3Dom).

Parameters:
content - Xpp3Dom element
name - Name of the element to be removed

doDependencyResolution

protected void doDependencyResolution(MavenProject project,
                                      ArtifactRepository localRepo)
                               throws InvalidDependencyVersionException,
                                      ProjectBuildingException,
                                      InvalidVersionSpecificationException
Throws:
InvalidDependencyVersionException
ProjectBuildingException
InvalidVersionSpecificationException

getPluginSetting

protected String getPluginSetting(String artifactId,
                                  String optionName,
                                  String defaultValue)

getLog

public Log getLog()
Specified by:
getLog in interface Mojo
Overrides:
getLog in class AbstractMojo


Copyright © 2002–2013 The Apache Software Foundation. All rights reserved.