Class ScriptingMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="scripted-goal",
          defaultPhase=COMPILE,
          requiresDependencyResolution=TEST)
    public class ScriptingMojo
    extends org.apache.maven.plugin.AbstractMojo
    Maven plugin goal to use JavaScript during any of build lifecycle phases.

    The Mojo provides a limited subset of the functionality provided Maven AntRun Plugin. This is intentional to simplify usage as this maven plugin is specifically targeted at building Pl/Java native code.

    • Field Summary

      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      ScriptingMojo()  
    • Constructor Detail

      • ScriptingMojo

        public ScriptingMojo()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException,
                            org.apache.maven.plugin.MojoFailureException
        Executes the javascript code inside script tag inside plugin configuration.
        Throws:
        org.apache.maven.plugin.MojoExecutionException
        org.apache.maven.plugin.MojoFailureException
      • setProjectProperty

        public void setProjectProperty​(String property,
                                       String value)
        Sets the value of a property for the current project.
        Parameters:
        property - key to use for property
        value - the value of property to set
      • getPgConfigProperty

        public String getPgConfigProperty​(String property)
        Returns the value of a pg_config property.
        Parameters:
        property - property whose value is to be retrieved from pg_config
        Returns:
        output of pg_config executed with the input property as argument
      • exceptionWrap

        public org.apache.maven.plugin.AbstractMojoExecutionException exceptionWrap​(Object object,
                                                                                    boolean scriptFailure)
        Wraps the input object in a AbstractMojoExecutionException. The returned exception is constructed as follows: 1) If object is null, then MojoExecutionException is used to wrap and the message indicates that null value was thrown by the script. 2) If object is already a MojoExecutionException, return it as is. 3) If object is already a MojoFailureException, return it as is. For the steps, below the wrapping exception is chosen according to the the value of scriptFailure parameter. 4) If object is any other Throwable, set it as the cause for the exception. 5) If object is a String, set it as the message of the exception. 6) For all other case, the message of the exception is set in this format , Class Name of object: String representation of object.
        Parameters:
        object - to wrap in AbstractMojoExecutionException
        scriptFailure - if true, use a MojoExecutionException for wrapping otherwise use MojoFailureException. this parameter is ignored, if the object is null or instance of MojoExecutionException or MojoFailureException
        Returns:
        object wrapped inside a AbstractMojoExecutionException