org.codehaus.mojo.exec
Class EclipseFormatterMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.codehaus.mojo.exec.AbstractExecMojo
          extended by org.codehaus.mojo.exec.ExecMojo
              extended by org.codehaus.mojo.exec.EclipseFormatterMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

public class EclipseFormatterMojo
extends ExecMojo

A plugin for executing the Eclipse java source code formatter

Author:
Jeff Caddel

Field Summary
private  String application
          This is the name of the Eclipse application that performs the formatting
private  String[] eclipseArgs
          Any arguments specified here are passed to the Eclipse binary as additional command line arguments.
private  String eclipseBinary
          Full path to the Eclipse executable binary
private  String[] excludes
          Regular expressions for directories to exclude from the formatting process.
private  String formatterPreferences
          Pointer to an Eclipse "org.eclipse.jdt.core.prefs" file.
private static String FS
           
private  String[] includes
          Regular expressions for directories that contain Java source code to format.
private  String[] javaBinaries
          Binaries representing a Java VM.
private  String vm
          Full path to a Java VM.
 
Fields inherited from class org.codehaus.mojo.exec.ExecMojo
CLASSPATH_TOKEN
 
Fields inherited from class org.codehaus.mojo.exec.AbstractExecMojo
classpathScope, project
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
EclipseFormatterMojo()
           
 
Method Summary
protected  void addIfNotEmpty(List<String> list, String s)
           
 void execute()
          priority in the execute method will be to use System properties arguments over the pom specification.
 String getApplication()
           
protected  String getConfigAbsolutePath()
           
 String[] getEclipseArgs()
           
protected  List<String> getEclipseArguments(List<File> dirs)
           
 String getEclipseBinary()
           
 String[] getExcludes()
           
 String getFormatterPreferences()
           
 String[] getIncludes()
           
 String[] getJavaBinaries()
           
protected  String getJavaBinary()
           
protected  List<File> getSourceDirectories()
           
 String getVm()
           
protected  String quote(String s)
           
 void setApplication(String application)
           
 void setEclipseArgs(String[] args)
           
 void setEclipseBinary(String eclipseExecutable)
           
 void setExcludes(String[] excludes)
           
 void setFormatterPreferences(String formatterPreferences)
           
 void setIncludes(String[] includes)
           
 void setJavaBinaries(String[] binaries)
           
 void setVm(String vm)
           
 
Methods inherited from class org.codehaus.mojo.exec.ExecMojo
executeCommandLine, getExecutable, getExecutablePath, getExecutor, getSuccessCodes, getSystemProperty, isResultCodeAFailure, setArguments, setBasedir, setExecutable, setProject, setSuccessCodes, setWorkingDirectory, setWorkingDirectory
 
Methods inherited from class org.codehaus.mojo.exec.AbstractExecMojo
collectProjectArtifactsAndClasspath, hasCommandlineArgs, isSkip, parseCommandlineArgs, registerSourceRoots
 
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

FS

private static final String FS

javaBinaries

private String[] javaBinaries
Binaries representing a Java VM. Default values are "javaw.exe", "java.exe", and "java". This list is searched in order, stopping as soon as one is found.


eclipseBinary

private String eclipseBinary
Full path to the Eclipse executable binary


vm

private String vm
Full path to a Java VM. This gets filled in using the system property "java.home" unless a value is supplied here.


application

private String application
This is the name of the Eclipse application that performs the formatting


formatterPreferences

private String formatterPreferences
Pointer to an Eclipse "org.eclipse.jdt.core.prefs" file. Supports "classpath:" style notation


eclipseArgs

private String[] eclipseArgs
Any arguments specified here are passed to the Eclipse binary as additional command line arguments. Default values are "-nosplash -verbose"


includes

private String[] includes
Regular expressions for directories that contain Java source code to format. Default values are **/src/main/java and **/src/test/java. The Eclipse formatter will recursively inspect any directories matching these patterns for *.java files


excludes

private String[] excludes
Regular expressions for directories to exclude from the formatting process.

Constructor Detail

EclipseFormatterMojo

public EclipseFormatterMojo()
Method Detail

getSourceDirectories

protected List<File> getSourceDirectories()

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException
Description copied from class: ExecMojo
priority in the execute method will be to use System properties arguments over the pom specification.

Specified by:
execute in interface org.apache.maven.plugin.Mojo
Overrides:
execute in class ExecMojo
Throws:
org.apache.maven.plugin.MojoExecutionException - if a failure happens

getJavaBinary

protected String getJavaBinary()
                        throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

getEclipseArguments

protected List<String> getEclipseArguments(List<File> dirs)
                                    throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

quote

protected String quote(String s)

getConfigAbsolutePath

protected String getConfigAbsolutePath()
                                throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

addIfNotEmpty

protected void addIfNotEmpty(List<String> list,
                             String s)

getEclipseBinary

public String getEclipseBinary()

setEclipseBinary

public void setEclipseBinary(String eclipseExecutable)

getVm

public String getVm()

setVm

public void setVm(String vm)

getApplication

public String getApplication()

setApplication

public void setApplication(String application)

getIncludes

public String[] getIncludes()

setIncludes

public void setIncludes(String[] includes)

getExcludes

public String[] getExcludes()

setExcludes

public void setExcludes(String[] excludes)

getJavaBinaries

public String[] getJavaBinaries()

setJavaBinaries

public void setJavaBinaries(String[] binaries)

getFormatterPreferences

public String getFormatterPreferences()

setFormatterPreferences

public void setFormatterPreferences(String formatterPreferences)

getEclipseArgs

public String[] getEclipseArgs()

setEclipseArgs

public void setEclipseArgs(String[] args)


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.