org.codehaus.mojo.exec
Class AbstractExecMojo

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

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

This class is used for unifying functionality between the 2 mojo exec plugins ('java' and 'exec'). It handles parsing the arguments and adding source/test folders.

Author:
Philippe Jacot (PJA), Jerome Lacoste

Field Summary
protected  String classpathScope
          Defines the scope of the classpath passed to the plugin.
private  String commandlineArgs
          Arguments for the executed program
protected  org.apache.maven.project.MavenProject project
          The enclosing project.
private  boolean skip
          Skip the execution.
private  File sourceRoot
          This folder is added to the list of those folders containing source to be compiled.
private  File testSourceRoot
          This folder is added to the list of those folders containing source to be compiled for testing.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractExecMojo()
           
 
Method Summary
protected  void collectProjectArtifactsAndClasspath(List artifacts, List theClasspathFiles)
          Collects the project artifacts in the specified List and the project specific classpath (build output and build test output) Files in the specified List, depending on the plugin classpathScope value.
protected  boolean hasCommandlineArgs()
           
protected  boolean isSkip()
          Check if the execution should be skipped
protected  String[] parseCommandlineArgs()
          Parses the argument string given by the user.
protected  void registerSourceRoots()
          Register compile and compile tests source roots if necessary
 
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
 
Methods inherited from interface org.apache.maven.plugin.Mojo
execute
 

Field Detail

project

protected org.apache.maven.project.MavenProject project
The enclosing project.


sourceRoot

private File sourceRoot
This folder is added to the list of those folders containing source to be compiled. Use this if your plugin generates source code.


testSourceRoot

private File testSourceRoot
This folder is added to the list of those folders containing source to be compiled for testing. Use this if your plugin generates test source code.


commandlineArgs

private String commandlineArgs
Arguments for the executed program


classpathScope

protected String classpathScope
Defines the scope of the classpath passed to the plugin. Set to compile,test,runtime or system depending on your needs. Since 1.1.2, the default value is 'runtime' instead of 'compile'.


skip

private boolean skip
Skip the execution.

Since:
1.0.1
Constructor Detail

AbstractExecMojo

public AbstractExecMojo()
Method Detail

collectProjectArtifactsAndClasspath

protected void collectProjectArtifactsAndClasspath(List artifacts,
                                                   List theClasspathFiles)
Collects the project artifacts in the specified List and the project specific classpath (build output and build test output) Files in the specified List, depending on the plugin classpathScope value.

Parameters:
artifacts - the list where to collect the scope specific artifacts
theClasspathFiles - the list where to collect the scope specific output directories

parseCommandlineArgs

protected String[] parseCommandlineArgs()
                                 throws org.apache.maven.plugin.MojoExecutionException
Parses the argument string given by the user. Strings are recognized as everything between STRING_WRAPPER. PARAMETER_DELIMITER is ignored inside a string. STRING_WRAPPER and PARAMETER_DELIMITER can be escaped using ESCAPE_CHAR.

Returns:
Array of String representing the arguments
Throws:
org.apache.maven.plugin.MojoExecutionException - for wrong formatted arguments

hasCommandlineArgs

protected boolean hasCommandlineArgs()
Returns:
true of the mojo has command line arguments

registerSourceRoots

protected void registerSourceRoots()
Register compile and compile tests source roots if necessary


isSkip

protected boolean isSkip()
Check if the execution should be skipped

Returns:
true to skip


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