com.atlassian.maven.plugins
Class AbstractIdeaMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by com.atlassian.maven.plugins.AbstractIdeaMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
IdeaModuleMojo, IdeaMojo, IdeaProjectMojo, IdeaWorkspaceMojo, Orion, Resin, Resin3, Test, Tomcat

public abstract class AbstractIdeaMojo
extends org.apache.maven.plugin.AbstractMojo

Author:
Edwin Punzalan

Field Summary
protected  java.lang.String appParams
           
protected  java.lang.String appPort
           
protected  org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
           
protected  org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
           
protected  org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
           
protected  java.util.Properties atlassianProperties
           
protected  org.apache.maven.project.MavenProject executedProject
          The Maven Project.
protected static boolean ideaHasBeenRun
           
protected  org.apache.maven.artifact.repository.ArtifactRepository localRepo
           
protected  org.apache.maven.plugin.logging.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  void addWebAppModules(org.dom4j.Element module)
           
protected  void callMavenIdea()
           
protected  org.dom4j.Element createElement(org.dom4j.Element module, java.lang.String name)
          Creates an Xpp3Dom element.
protected  void createOptions(org.dom4j.Element conf, java.lang.String mainClassName, java.lang.String vmParam, java.lang.String programParam, java.lang.String workingDir, java.lang.String moduleName)
           
protected  void doDependencyResolution(org.apache.maven.project.MavenProject project, org.apache.maven.artifact.repository.ArtifactRepository localRepo)
           
protected  org.dom4j.Element findComponent(org.dom4j.Element module, java.lang.String name)
          Finds element from the module element.
protected  org.dom4j.Element findElement(org.dom4j.Element component, java.lang.String name)
           
protected  org.dom4j.Element findElement(org.dom4j.Element element, java.lang.String elementName, java.lang.String attributeName)
           
protected  org.dom4j.Element findElement(org.dom4j.Element element, java.lang.String elementName, java.lang.String attributeName, java.lang.String attributeValue)
          Find an element with the "elementName" and "attributeName", "attributeValue" if it doesnt exist create it.
protected  org.dom4j.Element findElementWithAttribute(org.dom4j.Element element, java.lang.String elementName, java.lang.String attributeName)
           
protected  org.dom4j.Element findModule(org.dom4j.Element module, java.lang.String path)
          Find a module with the path parameter passed to it (used for *.ipr file)
 org.apache.maven.plugin.logging.Log getLog()
           
protected  java.lang.String getPluginSetting(java.lang.String artifactId, java.lang.String optionName, java.lang.String defaultValue)
           
protected  java.util.Set getProjectArtifacts()
           
protected  void initAtlassianVariables()
           
 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)
           
protected  java.lang.String invertSlashes(java.lang.String s)
          modifies backslashes to forwardslashes (may be an inherited bug from Java.lang.String.replaceFirst())
protected  void modifyEnvModule(java.lang.String location, java.io.File resourceFile, java.io.File imlFile)
           
protected  void modifyIpr(java.lang.String modulePath)
           
protected  void modifyResinEnvModule(java.io.File dir, boolean isResin3)
           
protected  org.dom4j.Document readXmlDocument(java.io.File file)
           
protected  org.dom4j.Document readXmlDocument(java.lang.String fileName)
           
protected  void removeElement(org.dom4j.Element element, java.lang.String elementName, java.lang.String attributeName)
           
protected  void removeElement(org.dom4j.Element element, java.lang.String elementName, java.lang.String attributeName, java.lang.String attributeValue)
           
protected  void removeOldElements(org.dom4j.Element content, java.lang.String name)
          Remove elements from content (Xpp3Dom).
protected  void replace(java.io.File file, java.lang.String regex, java.lang.String replacement)
           
protected  void replaceArtifactId(org.dom4j.Element module)
           
protected  void replaceJavaVersion(org.dom4j.Element module, java.io.File moduleFile)
           
protected  void replaceURLElement(org.dom4j.Element module, java.lang.String regex, java.lang.String property)
           
protected  java.lang.String toRelative(java.io.File basedir, java.lang.String absolutePath)
          Translate the absolutePath into its relative path.
protected  void writeXmlDocument(java.io.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 org.apache.maven.project.MavenProject executedProject
The Maven Project.


log

protected org.apache.maven.plugin.logging.Log log

overwrite

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


artifactFactory

protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory

localRepo

protected org.apache.maven.artifact.repository.ArtifactRepository localRepo

artifactResolver

protected org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver

artifactMetadataSource

protected org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource

appParams

protected java.lang.String appParams

appPort

protected java.lang.String appPort

atlassianProperties

protected java.util.Properties atlassianProperties

ideaHasBeenRun

protected static boolean ideaHasBeenRun
Constructor Detail

AbstractIdeaMojo

public AbstractIdeaMojo()
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)

readXmlDocument

protected org.dom4j.Document readXmlDocument(java.io.File file)
                                      throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

readXmlDocument

protected org.dom4j.Document readXmlDocument(java.lang.String fileName)
                                      throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

writeXmlDocument

protected void writeXmlDocument(java.io.File file,
                                org.dom4j.Document document)
                         throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

findComponent

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

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

findModule

protected org.dom4j.Element findModule(org.dom4j.Element module,
                                       java.lang.String path)
Find a module with the path parameter passed to it (used for *.ipr file)


findElement

protected org.dom4j.Element findElement(org.dom4j.Element element,
                                        java.lang.String elementName,
                                        java.lang.String attributeName,
                                        java.lang.String attributeValue)
Find an element with the "elementName" and "attributeName", "attributeValue" if it doesnt exist create it.


findElement

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

removeElement

protected void removeElement(org.dom4j.Element element,
                             java.lang.String elementName,
                             java.lang.String attributeName)

removeElement

protected void removeElement(org.dom4j.Element element,
                             java.lang.String elementName,
                             java.lang.String attributeName,
                             java.lang.String attributeValue)

findElement

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

findElementWithAttribute

protected org.dom4j.Element findElementWithAttribute(org.dom4j.Element element,
                                                     java.lang.String elementName,
                                                     java.lang.String attributeName)

createElement

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

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

toRelative

protected java.lang.String toRelative(java.io.File basedir,
                                      java.lang.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,
                                 java.lang.String name)
Remove elements from content (Xpp3Dom).

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

invertSlashes

protected java.lang.String invertSlashes(java.lang.String s)
modifies backslashes to forwardslashes (may be an inherited bug from Java.lang.String.replaceFirst())


doDependencyResolution

protected void doDependencyResolution(org.apache.maven.project.MavenProject project,
                                      org.apache.maven.artifact.repository.ArtifactRepository localRepo)
                               throws org.apache.maven.project.artifact.InvalidDependencyVersionException,
                                      org.apache.maven.project.ProjectBuildingException
Throws:
org.apache.maven.project.artifact.InvalidDependencyVersionException
org.apache.maven.project.ProjectBuildingException

getPluginSetting

protected java.lang.String getPluginSetting(java.lang.String artifactId,
                                            java.lang.String optionName,
                                            java.lang.String defaultValue)

getProjectArtifacts

protected java.util.Set getProjectArtifacts()

getLog

public org.apache.maven.plugin.logging.Log getLog()
Specified by:
getLog in interface org.apache.maven.plugin.Mojo
Overrides:
getLog in class org.apache.maven.plugin.AbstractMojo

initAtlassianVariables

protected void initAtlassianVariables()

replace

protected void replace(java.io.File file,
                       java.lang.String regex,
                       java.lang.String replacement)
                throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

modifyResinEnvModule

protected void modifyResinEnvModule(java.io.File dir,
                                    boolean isResin3)
                             throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

replaceJavaVersion

protected void replaceJavaVersion(org.dom4j.Element module,
                                  java.io.File moduleFile)

replaceURLElement

protected void replaceURLElement(org.dom4j.Element module,
                                 java.lang.String regex,
                                 java.lang.String property)

modifyIpr

protected void modifyIpr(java.lang.String modulePath)
                  throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

createOptions

protected void createOptions(org.dom4j.Element conf,
                             java.lang.String mainClassName,
                             java.lang.String vmParam,
                             java.lang.String programParam,
                             java.lang.String workingDir,
                             java.lang.String moduleName)

replaceArtifactId

protected void replaceArtifactId(org.dom4j.Element module)
                          throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

addWebAppModules

protected void addWebAppModules(org.dom4j.Element module)
                         throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

modifyEnvModule

protected void modifyEnvModule(java.lang.String location,
                               java.io.File resourceFile,
                               java.io.File imlFile)
                        throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

callMavenIdea

protected void callMavenIdea()
                      throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException


Copyright © 2006 null. All Rights Reserved.