org.apache.maven.plugin.eclipse
Class EclipsePlugin

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.ide.AbstractIdeSupportMojo
          extended by org.apache.maven.plugin.eclipse.EclipsePlugin
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.codehaus.plexus.logging.LogEnabled
Direct Known Subclasses:
M2EclipseMojo, MyEclipsePlugin, RadPlugin

public class EclipsePlugin
extends AbstractIdeSupportMojo

Generates the following eclipse configuration files:

If this goal is run on a multiproject root, dependencies between modules will be configured as direct project dependencies in Eclipse (unless useProjectReferences is set to false).

Version:
$Id: EclipsePlugin.java 599461 2007-11-29 14:43:17Z aheritier $
Author:
Trygve Laugstøl, Fabrizio Giustina

Field Summary
protected static String BUILDER_WST_VALIDATION
           
protected static String COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER
           
protected static String REQUIRED_PLUGINS_CONTAINER
           
static String[] WTP_SUPPORTED_VERSIONS
           
 
Fields inherited from class org.apache.maven.plugin.ide.AbstractIdeSupportMojo
artifactCollector, artifactFactory, artifactMetadataSource, artifactResolver, downloadJavadocs, downloadSources, executedProject, localRepository, packaging, project, reactorProjects, remoteArtifactRepositories
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
EclipsePlugin()
           
 
Method Summary
 EclipseSourceDir[] buildDirectoryList(org.apache.maven.project.MavenProject project, File basedir, File buildOutputDirectory)
           
protected  void checkExtraDeprecations()
           
protected  void convertBuildCommandList(List commands)
           
protected  EclipseWriterConfig createEclipseWriterConfig(IdeDependency[] deps)
           
protected  void fillDefaultBuilders(String packaging)
           
protected  void fillDefaultClasspathContainers(String packaging)
           
protected  void fillDefaultNatures(String packaging)
           
 List getAdditionalBuildcommands()
          Getter for additionalBuildcommands.
 List getAdditionalProjectnatures()
          Getter for additionalProjectnatures.
 List getBuildcommands()
          Getter for buildcommands.
 File getBuildOutputDirectory()
          Getter for buildOutputDirectory.
 List getClasspathContainers()
          Getter for classpathContainers.
 File getEclipseProjectDir()
          Getter for eclipseProjectDir.
 String getProjectNameForArifact(org.apache.maven.artifact.Artifact artifact)
          Find the name of the project as used in eclipse.
 String getProjectNameTemplate()
           
 List getProjectnatures()
          Getter for projectnatures.
 boolean getUseProjectReferences()
          Getter for useProjectReferences.
 String getWtpversion()
          Getter for wtpversion.
 boolean isAddGroupIdToProjectName()
          Getter for addGroupIdToProjectName.
 boolean isAddVersionToProjectName()
          Getter for addVersionToProjectName.
protected  boolean isJavaProject()
           
protected  boolean isPdeProject()
           
 void setAddGroupIdToProjectName(boolean addGroupIdToProjectName)
          Setter for addGroupIdToProjectName.
 void setAdditionalBuildcommands(List additionalBuildcommands)
          Setter for additionalBuildcommands.
 void setAdditionalProjectnatures(List additionalProjectnatures)
          Setter for additionalProjectnatures.
 void setAddVersionToProjectName(boolean addVersionToProjectName)
          Setter for addVersionToProjectName.
 void setBuildcommands(List buildcommands)
          Setter for buildcommands.
 void setBuildOutputDirectory(File buildOutputDirectory)
          Setter for buildOutputDirectory.
 void setClasspathContainers(List classpathContainers)
          Setter for classpathContainers.
 void setEclipseProjectDir(File eclipseProjectDir)
          Setter for eclipseProjectDir.
 void setProjectNameTemplate(String projectNameTemplate)
           
 void setProjectnatures(List projectnatures)
          Setter for projectnatures.
 boolean setup()
          Hook for preparation steps before the actual plugin execution.
protected  void setupExtras()
           
 void setUseProjectReferences(boolean useProjectReferences)
          Setter for useProjectReferences.
 void setWtpversion(String wtpversion)
          Setter for wtpversion.
protected  void validateExtras()
           
protected  void verifyClasspathContainerListIsComplete()
           
 void writeConfiguration(IdeDependency[] deps)
          Main plugin method where dependencies should be processed in order to generate IDE configuration files.
protected  void writeExtraConfiguration(EclipseWriterConfig config)
          Write any extra configuration information for the Eclipse project.
 
Methods inherited from class org.apache.maven.plugin.ide.AbstractIdeSupportMojo
doDependencyResolution, enableLogging, execute, getArtifactFactory, getArtifactMetadataSource, getArtifactResolver, getDownloadJavadocs, getDownloadSources, getExecutedProject, getLocalRepository, getProject, getReactorProjects, getRemoteArtifactRepositories, isResolveDependencies, setArtifactFactory, setArtifactMetadataSource, setArtifactResolver, setDownloadJavadocs, setDownloadSources, setExecutedProject, setLocalRepository, setProject, setReactorProjects, setRemoteArtifactRepositories, setResolveDependencies
 
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

BUILDER_WST_VALIDATION

protected static final String BUILDER_WST_VALIDATION
See Also:
Constant Field Values

COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER

protected static final String COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER
See Also:
Constant Field Values

REQUIRED_PLUGINS_CONTAINER

protected static final String REQUIRED_PLUGINS_CONTAINER
See Also:
Constant Field Values

WTP_SUPPORTED_VERSIONS

public static final String[] WTP_SUPPORTED_VERSIONS
Constructor Detail

EclipsePlugin

public EclipsePlugin()
Method Detail

isJavaProject

protected boolean isJavaProject()

isPdeProject

protected boolean isPdeProject()

getBuildcommands

public List getBuildcommands()
Getter for buildcommands.

Returns:
Returns the buildcommands.

setBuildcommands

public void setBuildcommands(List buildcommands)
Setter for buildcommands.

Parameters:
buildcommands - The buildcommands to set.

getBuildOutputDirectory

public File getBuildOutputDirectory()
Getter for buildOutputDirectory.

Returns:
Returns the buildOutputDirectory.

setBuildOutputDirectory

public void setBuildOutputDirectory(File buildOutputDirectory)
Setter for buildOutputDirectory.

Parameters:
buildOutputDirectory - The buildOutputDirectory to set.

getClasspathContainers

public List getClasspathContainers()
Getter for classpathContainers.

Returns:
Returns the classpathContainers.

setClasspathContainers

public void setClasspathContainers(List classpathContainers)
Setter for classpathContainers.

Parameters:
classpathContainers - The classpathContainers to set.

getEclipseProjectDir

public File getEclipseProjectDir()
Getter for eclipseProjectDir.

Returns:
Returns the eclipseProjectDir.

setEclipseProjectDir

public void setEclipseProjectDir(File eclipseProjectDir)
Setter for eclipseProjectDir.

Parameters:
eclipseProjectDir - The eclipseProjectDir to set.

getProjectnatures

public List getProjectnatures()
Getter for projectnatures.

Returns:
Returns the projectnatures.

setProjectnatures

public void setProjectnatures(List projectnatures)
Setter for projectnatures.

Parameters:
projectnatures - The projectnatures to set.

getUseProjectReferences

public boolean getUseProjectReferences()
Getter for useProjectReferences.

Specified by:
getUseProjectReferences in class AbstractIdeSupportMojo
Returns:
Returns the useProjectReferences.

setUseProjectReferences

public void setUseProjectReferences(boolean useProjectReferences)
Setter for useProjectReferences.

Parameters:
useProjectReferences - The useProjectReferences to set.

getWtpversion

public String getWtpversion()
Getter for wtpversion.

Returns:
Returns the wtpversion.

setWtpversion

public void setWtpversion(String wtpversion)
Setter for wtpversion.

Parameters:
wtpversion - The wtpversion to set.

getAdditionalBuildcommands

public List getAdditionalBuildcommands()
Getter for additionalBuildcommands.

Returns:
Returns the additionalBuildcommands.

setAdditionalBuildcommands

public void setAdditionalBuildcommands(List additionalBuildcommands)
Setter for additionalBuildcommands.

Parameters:
additionalBuildcommands - The additionalBuildcommands to set.

getAdditionalProjectnatures

public List getAdditionalProjectnatures()
Getter for additionalProjectnatures.

Returns:
Returns the additionalProjectnatures.

setAdditionalProjectnatures

public void setAdditionalProjectnatures(List additionalProjectnatures)
Setter for additionalProjectnatures.

Parameters:
additionalProjectnatures - The additionalProjectnatures to set.

isAddVersionToProjectName

public boolean isAddVersionToProjectName()
Getter for addVersionToProjectName.


setAddVersionToProjectName

public void setAddVersionToProjectName(boolean addVersionToProjectName)
Setter for addVersionToProjectName.


isAddGroupIdToProjectName

public boolean isAddGroupIdToProjectName()
Getter for addGroupIdToProjectName.


setAddGroupIdToProjectName

public void setAddGroupIdToProjectName(boolean addGroupIdToProjectName)
Setter for addGroupIdToProjectName.


getProjectNameTemplate

public String getProjectNameTemplate()

setProjectNameTemplate

public void setProjectNameTemplate(String projectNameTemplate)

setup

public boolean setup()
              throws org.apache.maven.plugin.MojoExecutionException
Description copied from class: AbstractIdeSupportMojo
Hook for preparation steps before the actual plugin execution.

Specified by:
setup in class AbstractIdeSupportMojo
Returns:
true if execution should continue or false if not.
Throws:
org.apache.maven.plugin.MojoExecutionException - generic mojo exception
See Also:
Mojo.execute()

convertBuildCommandList

protected void convertBuildCommandList(List commands)

setupExtras

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

verifyClasspathContainerListIsComplete

protected void verifyClasspathContainerListIsComplete()

validateExtras

protected void validateExtras()

checkExtraDeprecations

protected void checkExtraDeprecations()

writeConfiguration

public void writeConfiguration(IdeDependency[] deps)
                        throws org.apache.maven.plugin.MojoExecutionException
Description copied from class: AbstractIdeSupportMojo
Main plugin method where dependencies should be processed in order to generate IDE configuration files.

Specified by:
writeConfiguration in class AbstractIdeSupportMojo
Parameters:
deps - list of IdeDependency objects, with artifacts, sources and javadocs already resolved
Throws:
org.apache.maven.plugin.MojoExecutionException - generic mojo exception

createEclipseWriterConfig

protected EclipseWriterConfig createEclipseWriterConfig(IdeDependency[] deps)
                                                 throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

writeExtraConfiguration

protected void writeExtraConfiguration(EclipseWriterConfig config)
                                throws org.apache.maven.plugin.MojoExecutionException
Write any extra configuration information for the Eclipse project. This is an extension point, called before the main configurations are written.
NOTE: This could change the config!

Parameters:
config -
Throws:
org.apache.maven.plugin.MojoExecutionException

fillDefaultNatures

protected void fillDefaultNatures(String packaging)

fillDefaultClasspathContainers

protected void fillDefaultClasspathContainers(String packaging)

fillDefaultBuilders

protected void fillDefaultBuilders(String packaging)

buildDirectoryList

public EclipseSourceDir[] buildDirectoryList(org.apache.maven.project.MavenProject project,
                                             File basedir,
                                             File buildOutputDirectory)
                                      throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

getProjectNameForArifact

public String getProjectNameForArifact(org.apache.maven.artifact.Artifact artifact)
Find the name of the project as used in eclipse.

Specified by:
getProjectNameForArifact in class AbstractIdeSupportMojo
Parameters:
artifact - The artifact to find the eclipse name for.
Returns:
The name os the eclipse project.


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.