org.codehaus.mojo.freeform.mojo
Class GenerateNetbeansProjectMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.codehaus.mojo.freeform.mojo.GenerateNetbeansProjectMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

public class GenerateNetbeansProjectMojo
extends org.apache.maven.plugin.AbstractMojo

Integrate the use of Maven 2 with Netbeans 4.x.

Author:
Rapha��l Pi��roni

Field Summary
protected  String additionalFiles
          A comma separated list of additional files to view.
protected  String additionalFolders
          A comma separated list of additionnal folders to view.
protected  String additionalGoals
          A comma separated list of additional goals to call from Netbeans.
protected  org.apache.maven.project.MavenProject executedProject
          The currently executed project.
protected  org.apache.maven.artifact.repository.ArtifactRepository localRepository
          Local maven repository.
protected  String mavenpath
          The path to the Maven executable.
protected  String outputDirectory
          The directory where to write the nbproject directory and Netbeans project files.
protected  org.apache.maven.project.MavenProject project
          The project whose project files to create.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
GenerateNetbeansProjectMojo()
           
 
Method Summary
protected  void addAdditionalActions(Analyser analyser)
          This method adds the List of actions defined in the additionalGoals attribute to the given analyser.
protected  void addAdditionalFiles(Analyser analyser)
          This method adds the List of files defined in the additionalFiles attribute to the given analyser.
protected  void addAdditionalFolders(Analyser analyser)
          This method adds the List of folders defined in the additionalFolders attribute to the given analyser.
protected  void addAdditionalTargets(Analyser analyser)
          This method adds the List of ant targets defined in the additionalGoals attribute to the given analyser.
protected  Analyser analyse()
          This method creates the Analyser for the MavenProject then calls analyseProject and analyseTargets on it.
protected  File createNetbeansProjectDirectory()
          This methods creates the nbproject directory that will hold the netbeans descriptor file and ant script.
 void execute()
          This method is the starting method of this class.
 void setAdditionalFiles(String additionalFiles)
          Setter for the additionalFiles property.
 void setAdditionalFolders(String additionalFolders)
          Setter for the additionalFolders property.
 void setAdditionalGoals(String additionalGoals)
          Setter for the additionalGoals property.
 void setExecutedProject(org.apache.maven.project.MavenProject executedProject)
          Setter for property executedProject.
 void setLocalRepository(org.apache.maven.artifact.repository.ArtifactRepository localRepository)
          Setter for property localRepository.
 void setMavenPath(String mavenpath)
          Setter for property mavenpath.
 void setOutputDirectory(String outputDirectory)
          Setter for the outputDirectory property.
 void setProject(org.apache.maven.project.MavenProject project)
          Setter for property project.
protected  void writeIdeFileTargetsFile(File netbeansProjectDirectory, FreeformProject freeformProject)
          This method writes the ide-file-targets.xml file given the directory where to save the file and the FreeformProject to write in.
protected  void writeMavencallFile(File netbeansProjectDirectory, boolean useOutputDirectory, List antTargets)
          This method write the mavencall.xml file given the directory where to save the file and the list of AntTarget to write in.
protected  void writeProjectFile(File netbeansProjectDirectory, FreeformProject freeformProject)
          This method write the project.xml file given the directory where to save the file and the FreeformProject to write in.
protected  void writePropertyFile(File netbeansProjectDirectory, String repositoryBasedir)
          This method write the project.properties file given the directory where to save the file and the FreeformProject to write in.
 
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

localRepository

protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
Local maven repository.


executedProject

protected org.apache.maven.project.MavenProject executedProject
The currently executed project.


project

protected org.apache.maven.project.MavenProject project
The project whose project files to create.


additionalFiles

protected String additionalFiles
A comma separated list of additional files to view.


additionalFolders

protected String additionalFolders
A comma separated list of additionnal folders to view.


additionalGoals

protected String additionalGoals
A comma separated list of additional goals to call from Netbeans.


mavenpath

protected String mavenpath
The path to the Maven executable.


outputDirectory

protected String outputDirectory
The directory where to write the nbproject directory and Netbeans project files. Defaults to the directory where the pom.xml file reside, if this parameter is left empty.

Constructor Detail

GenerateNetbeansProjectMojo

public GenerateNetbeansProjectMojo()
Method Detail

setOutputDirectory

public void setOutputDirectory(String outputDirectory)
Setter for the outputDirectory property.

Parameters:
outputDirectory - The new outputDirectory.

setAdditionalFiles

public void setAdditionalFiles(String additionalFiles)
Setter for the additionalFiles property.

Parameters:
additionalFiles - The new additionalFiles.

setAdditionalFolders

public void setAdditionalFolders(String additionalFolders)
Setter for the additionalFolders property.

Parameters:
additionalFolders - The new additionalFolders.

setAdditionalGoals

public void setAdditionalGoals(String additionalGoals)
Setter for the additionalGoals property.

Parameters:
additionalGoals - The new additionalGoals.

setExecutedProject

public void setExecutedProject(org.apache.maven.project.MavenProject executedProject)
Setter for property executedProject.

Parameters:
executedProject - New value of property executedProject.

setLocalRepository

public void setLocalRepository(org.apache.maven.artifact.repository.ArtifactRepository localRepository)
Setter for property localRepository.

Parameters:
localRepository - New value of property localRepository.

setProject

public void setProject(org.apache.maven.project.MavenProject project)
Setter for property project.

Parameters:
project - New value of property project.

setMavenPath

public void setMavenPath(String mavenpath)
Setter for property mavenpath.

Parameters:
mavenpath - New value of property mavenpath.

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException
This method is the starting method of this class. It is used by Maven 2 to call the this Mojo.

Throws:
org.apache.maven.plugin.MojoExecutionException - if something goes wrong. That Exception will be wrapped on any FreeformPluginException thrown during the plugin execution.

addAdditionalActions

protected void addAdditionalActions(Analyser analyser)
                             throws FreeformPluginException
This method adds the List of actions defined in the additionalGoals attribute to the given analyser.

Parameters:
analyser - The analyser to add the actions in.
Throws:
FreeformPluginException - if something goes wrong.

addAdditionalFiles

protected void addAdditionalFiles(Analyser analyser)
                           throws FreeformPluginException
This method adds the List of files defined in the additionalFiles attribute to the given analyser.

Parameters:
analyser - The analyser to add the files in.
Throws:
FreeformPluginException - if something goes wrong.

addAdditionalFolders

protected void addAdditionalFolders(Analyser analyser)
                             throws FreeformPluginException
This method adds the List of folders defined in the additionalFolders attribute to the given analyser.

Parameters:
analyser - The analyser to add the folders in.
Throws:
FreeformPluginException - if something goes wrong.

addAdditionalTargets

protected void addAdditionalTargets(Analyser analyser)
                             throws FreeformPluginException
This method adds the List of ant targets defined in the additionalGoals attribute to the given analyser.

Parameters:
analyser - The analyser to add the tergets in.
Throws:
FreeformPluginException - if something goes wrong.

analyse

protected Analyser analyse()
                    throws FreeformPluginException
This method creates the Analyser for the MavenProject then calls analyseProject and analyseTargets on it.

Returns:
The analyser which analysed the MavenProject with the computed FreeformProject and List of AntTargets.
Throws:
FreeformPluginException - if something goes wrong.

createNetbeansProjectDirectory

protected File createNetbeansProjectDirectory()
                                       throws FreeformPluginException
This methods creates the nbproject directory that will hold the netbeans descriptor file and ant script.

Returns:
The nbproject directory as a File.
Throws:
FreeformPluginException - if something goes wrong.

writeMavencallFile

protected void writeMavencallFile(File netbeansProjectDirectory,
                                  boolean useOutputDirectory,
                                  List antTargets)
                           throws FreeformPluginException
This method write the mavencall.xml file given the directory where to save the file and the list of AntTarget to write in.

Parameters:
useOutputDirectory - whether the project elements contains reference to the project directory or not.
netbeansProjectDirectory - The directory to write the mavencall.xml file.
antTargets - The list of AntTarget to write in the file.
Throws:
FreeformPluginException - if something goes wrong.

writeProjectFile

protected void writeProjectFile(File netbeansProjectDirectory,
                                FreeformProject freeformProject)
                         throws FreeformPluginException
This method write the project.xml file given the directory where to save the file and the FreeformProject to write in.

Parameters:
netbeansProjectDirectory - The directory to write the mavencall.xml file.
freeformProject - The FreeformProject to write in the file.
Throws:
FreeformPluginException - if something goes wrong.

writePropertyFile

protected void writePropertyFile(File netbeansProjectDirectory,
                                 String repositoryBasedir)
                          throws FreeformPluginException
This method write the project.properties file given the directory where to save the file and the FreeformProject to write in.

Parameters:
repositoryBasedir - Not used.
netbeansProjectDirectory - The directory to write the mavencall.xml file.
Throws:
FreeformPluginException - if something goes wrong.

writeIdeFileTargetsFile

protected void writeIdeFileTargetsFile(File netbeansProjectDirectory,
                                       FreeformProject freeformProject)
                                throws FreeformPluginException
This method writes the ide-file-targets.xml file given the directory where to save the file and the FreeformProject to write in.

Parameters:
netbeansProjectDirectory - The directory to write the ide-file-targets.xml file.
freeformProject - The FreeformProject to write in the file.
Throws:
FreeformPluginException - if something goes wrong.


Copyright © 2005-2011 Codehaus. All Rights Reserved.