Package org.tentackle.maven
Class ToolRunner
- java.lang.Object
-
- org.tentackle.maven.ToolRunner
-
public class ToolRunner extends java.lang.ObjectRunner for external tools.
-
-
Constructor Summary
Constructors Constructor Description ToolRunner(java.io.File tool)Creates a runner for a tool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ToolRunnerarg(java.lang.Object... args)Adds arguments.voidclear()Clears arguments and results.intgetErrCode()Gets the error code.java.util.List<java.lang.String>getErrors()Gets the standard error output.java.lang.StringgetErrorsAsString()Gets the standard error output.java.util.List<java.lang.String>getOutput()Gets the standard output.java.lang.StringgetOutputAsString()Gets the standard output.ToolRunnerrun()Runs the tool.java.lang.StringtoString()
-
-
-
Method Detail
-
arg
public ToolRunner arg(java.lang.Object... args)
Adds arguments.- Parameters:
args- the arguments- Returns:
- this runner
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
run
public ToolRunner run() throws org.apache.maven.plugin.MojoExecutionException
Runs the tool.- Returns:
- this runner
- Throws:
org.apache.maven.plugin.MojoExecutionException- if running the tool failed
-
getOutput
public java.util.List<java.lang.String> getOutput() throws org.apache.maven.plugin.MojoExecutionExceptionGets the standard output.- Returns:
- the output lines, never null
- Throws:
org.apache.maven.plugin.MojoExecutionException- if run method not invoked
-
getOutputAsString
public java.lang.String getOutputAsString() throws org.apache.maven.plugin.MojoExecutionExceptionGets the standard output.- Returns:
- the output, never null
- Throws:
org.apache.maven.plugin.MojoExecutionException- if run method not invoked
-
getErrors
public java.util.List<java.lang.String> getErrors() throws org.apache.maven.plugin.MojoExecutionExceptionGets the standard error output.- Returns:
- the error lines, never null
- Throws:
org.apache.maven.plugin.MojoExecutionException- if run method not invoked
-
getErrorsAsString
public java.lang.String getErrorsAsString() throws org.apache.maven.plugin.MojoExecutionExceptionGets the standard error output.- Returns:
- the errors, never null
- Throws:
org.apache.maven.plugin.MojoExecutionException- if run method not invoked
-
getErrCode
public int getErrCode() throws org.apache.maven.plugin.MojoExecutionExceptionGets the error code.- Returns:
- the error, 0 if ok
- Throws:
org.apache.maven.plugin.MojoExecutionException- if run method not invoked
-
clear
public void clear()
Clears arguments and results.
-
-