Class AbstractToolsMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.codehaus.gmavenplus.mojo.AbstractGroovyMojo
org.codehaus.gmavenplus.mojo.AbstractToolsMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
ConsoleMojo, ExecuteMojo, ShellMojo

public abstract class AbstractToolsMojo extends AbstractGroovyMojo
The base tools mojo, which all tool mojos extend. Note that it references the plugin classloader to pull in dependencies Groovy didn't include (for things like Ant for AntBuilder, Ivy for @grab, and Jansi for Groovysh). Note that using the ant property requires Java 8, as the included Ant version was compiled for Java 8.
Since:
1.1
Author:
Keegan Witt
  • Field Details

    • projectHelper

      @Component protected org.apache.maven.project.MavenProjectHelper projectHelper
      Maven ProjectHelper to use in properties.
      Since:
      1.3
    • properties

      @Parameter protected Properties properties
      Properties to make available in scripts as variables using the property name. By default will include
      project
      A org.apache.maven.project.Project object of the current Maven project.
      session
      A org.apache.maven.execution.MavenSession object of the current Maven session.
      pluginArtifacts
      A list of org.apache.maven.artifact.Artifact objects of this plugin's artifacts.
      mojoExecution
      A org.apache.maven.plugin.MojoExecution object of this plugin's mojo execution.
      log
      A org.apache.maven.plugin.logging.Log object of Maven's log.
      ant
      A groovy.util.AntBuilder object (if groovy.ant.AntBuilder or groovy.util.AntBuilder is available).
      These can be overridden.
      Since:
      1.0-beta-3
    • allowSystemExits

      @Parameter(defaultValue="true") protected boolean allowSystemExits
      Whether to allow System.exit() to be used. Should not be set to false when using parallel execution, as it isn't thread-safe.
      Since:
      1.2
    • bindPropertiesToSeparateVariables

      @Parameter(defaultValue="true") protected boolean bindPropertiesToSeparateVariables
      Whether to bind each property to a separate variable (otherwise binds properties to a single 'properties' variable).
      Since:
      1.2
    • includeClasspath

      @Parameter(defaultValue="PROJECT_AND_PLUGIN") protected IncludeClasspath includeClasspath
      What classpath to include. One of
      • PROJECT_ONLY
      • PROJECT_AND_PLUGIN
      • PLUGIN_ONLY
      Uses the same scope as the required dependency resolution of this mojo. Use only if you know what you're doing.
      Since:
      1.8.0
    • bindAllProjectProperties

      @Parameter(defaultValue="false") protected boolean bindAllProjectProperties
      Whether to add all properties from project.properties into properties.
      Since:
      1.10.1
    • bindSessionUserOverrideProperties

      @Parameter(defaultValue="false") protected boolean bindSessionUserOverrideProperties
      Whether to add user session properties from session.userProperties that override project properties into properties. bindAllSessionUserProperties takes priority over this property if present. Has no effect if bindAllProjectProperties is false.
      Since:
      1.10.1
    • bindAllSessionUserProperties

      @Parameter(defaultValue="false") protected boolean bindAllSessionUserProperties
      Whether to add all properties from session.userProperties into properties. If both bindAllProjectProperties and bindAllSessionUserProperties are specified, the session properties will override the project properties, but it will also include properties not present in project properties. To only include user session properties that are also in project properties, use bindSessionUserOverrideProperties.
      Since:
      1.10.1
  • Constructor Details

    • AbstractToolsMojo

      public AbstractToolsMojo()
  • Method Details

    • initializeProperties

      protected void initializeProperties()
      Initializes the properties field.
    • logUnableToInitializeAntBuilder

      protected void logUnableToInitializeAntBuilder(Throwable e)
      Logs errors that caused the 'ant' object to not be populated.
      Parameters:
      e - the exception causing the failure