Package ru.akman.maven.plugins
Class BaseToolMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
ru.akman.maven.plugins.BaseToolMojo
- All Implemented Interfaces:
- org.apache.maven.plugin.ContextEnabled,- org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
- JlinkMojo
public abstract class BaseToolMojo
extends org.apache.maven.plugin.AbstractMojo
Base class for creating a CLI tool Mojos.
- 
Field SummaryFields inherited from interface org.apache.maven.plugin.MojoROLE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected intexecCmdLine(org.codehaus.plexus.util.cli.Commandline cmdLine) Execute command line.protected intexecCmdLine(org.codehaus.plexus.util.cli.Commandline cmdLine, org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer out, org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer err) Execute command line with defined standard output/error streams.protected FileGet project base directory.protected FileGet project build directory.protected CharsetGet default charset.protected org.apache.maven.shared.model.fileset.util.FileSetManagerGet fileset manager.protected FileGet project output directory.protected org.apache.maven.plugin.BuildPluginManagerGet plugin manager.protected org.apache.maven.project.MavenProjectGet maven project.protected PropertiesGet project properties.protected org.apache.maven.execution.MavenSessionGet maven session.protected org.apache.maven.toolchain.ToolchainGet JDK toolchain from build context, i.e. the toolchain selected by maven-toolchains-plugin.protected org.apache.maven.toolchain.ToolchainManagerGet toolchain manager.protected List<org.apache.maven.toolchain.Toolchain>Get list of all JDK toolchains available in user settings independently from maven-toolchains-plugin.protected FileGet tool executable.protected FileGet tool home directory.protected org.apache.commons.lang3.JavaVersionGet tool corresponding java version.protected StringGet tool version.protected voidInit Mojo.Methods inherited from class org.apache.maven.plugin.AbstractMojogetLog, getPluginContext, setLog, setPluginContextMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.plugin.Mojoexecute
- 
Constructor Details- 
BaseToolMojopublic BaseToolMojo()
 
- 
- 
Method Details- 
getBaseDirGet project base directory.- Returns:
- project base directory (that containing the pom.xml file)
 
- 
getBuildDirGet project build directory.- Returns:
- project build directory (${project.basedir}/target)
 
- 
getOutputDirGet project output directory.- Returns:
- project output directory (${project.build.directory}/classes)
 
- 
getPropertiesGet project properties.- Returns:
- project properties
 
- 
getCharsetGet default charset.- Returns:
- default charset (${project.build.sourceEncoding})
 
- 
getFileSetManagerprotected org.apache.maven.shared.model.fileset.util.FileSetManager getFileSetManager()Get fileset manager.- Returns:
- fileset manager
 
- 
getToolchainsGet list of all JDK toolchains available in user settings independently from maven-toolchains-plugin.- Returns:
- list of all JDK toolchains available in user settings
 
- 
getToolchainprotected org.apache.maven.toolchain.Toolchain getToolchain()Get JDK toolchain from build context, i.e. the toolchain selected by maven-toolchains-plugin.- Returns:
- JDK toolchain from build context
 
- 
getToolHomeDirectoryGet tool home directory.- Returns:
- tool home directory
 
- 
getToolExecutableGet tool executable.- Returns:
- tool executable
 
- 
getToolVersionGet tool version.- Returns:
- tool version
 
- 
getToolJavaVersionprotected org.apache.commons.lang3.JavaVersion getToolJavaVersion()Get tool corresponding java version.- Returns:
- tool corresponding java version
 
- 
getToolchainManagerprotected org.apache.maven.toolchain.ToolchainManager getToolchainManager()Get toolchain manager.- Returns:
- toolchain manager
 
- 
getPluginManagerprotected org.apache.maven.plugin.BuildPluginManager getPluginManager()Get plugin manager.- Returns:
- plugin manager
 
- 
getProjectprotected org.apache.maven.project.MavenProject getProject()Get maven project.- Returns:
- maven project
 
- 
getSessionprotected org.apache.maven.execution.MavenSession getSession()Get maven session.- Returns:
- maven session
 
- 
execCmdLineprotected int execCmdLine(org.codehaus.plexus.util.cli.Commandline cmdLine) throws org.codehaus.plexus.util.cli.CommandLineException Execute command line.- Parameters:
- cmdLine- command line
- Returns:
- exit code
- Throws:
- org.codehaus.plexus.util.cli.CommandLineException- if any errors occurred while processing command line
 
- 
execCmdLineprotected int execCmdLine(org.codehaus.plexus.util.cli.Commandline cmdLine, org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer out, org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer err) throws org.codehaus.plexus.util.cli.CommandLineException Execute command line with defined standard output/error streams.- Parameters:
- cmdLine- command line
- out- standard output, can be null
- err- standard error, can be null
- Returns:
- exit code
- Throws:
- org.codehaus.plexus.util.cli.CommandLineException- if any errors occurred while processing command line
 
- 
initprotected void init(String toolName, File toolHomeDir, String toolBinDirName) throws org.apache.maven.plugin.MojoExecutionException Init Mojo.- Parameters:
- toolName- the name of the tool (without extension)
- toolHomeDir- the tool home directory
- toolBinDirName- the name of subdirectory where the tool live relative to the tool home directory
- Throws:
- org.apache.maven.plugin.MojoExecutionException- if any errors occurred while processing configuration parameters
 
 
-