Interface JavaTool<Request extends JavaToolRequest>
-
- Type Parameters:
Request
- Tool-specific request type
- All Known Implementing Classes:
AbstractJavaTool
public interface JavaTool<Request extends JavaToolRequest>
Describes a java tool, means a executable available in the jdk.
The name of the tool (
getJavaToolName()
) reflects the name of the executable that should exists as an executable in the jdk, likejarsigner, keytool, javadoc, ...
.An abstract implementation of the
JavaTool
namedAbstractJavaTool
use the command line API to execute any user requests of this tool.- Since:
- 0.5
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JavaToolResult
execute(Request request)
Execute the input request and then returns the result of the execution.java.lang.String
getJavaToolName()
Return the name of the java tool.void
setToolchain(java.lang.Object toolchain)
Set an optional tool chain to find out the java tool executable location.
-
-
-
Method Detail
-
getJavaToolName
java.lang.String getJavaToolName()
Return the name of the java tool. This is exactly the name (without his extension) of the executable to find in the
jdk/bin
directory.For example:
jarsigner, keytool, javadoc, ...
- Returns:
- the name of the java tool.
-
setToolchain
void setToolchain(java.lang.Object toolchain)
Set an optional tool chain to find out the java tool executable location.- Parameters:
toolchain
- optional tool chain to find out the java tool executable location. To avoid direct dependency on Maven core, this parameter is an Object that will be used as Toolchain through reflection
-
execute
JavaToolResult execute(Request request) throws JavaToolException
Execute the input request and then returns the result of the execution.
If could not create the java tool invocation, a
JavaToolException
will be thrown.If execution fails, then the result will have a none-zero
JavaToolResult.getExitCode()
and hisJavaToolResult.getExecutionException()
will be filled with the error, otherwise the exist code will be zero.- Parameters:
request
- the request to perform- Returns:
- the result of the tool execution
- Throws:
JavaToolException
- if could not create the java tool invocation
-
-