Package org.postgresql.pljava.pgxs
Class ScriptingMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.postgresql.pljava.pgxs.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.
-
-
Constructor Summary
Constructors Constructor Description ScriptingMojo()
-
Method Summary
Modifier and Type Method Description org.apache.maven.plugin.AbstractMojoExecutionException
exceptionWrap(Object object, boolean scriptFailure)
Wraps the input object in aAbstractMojoExecutionException
.void
execute()
Executes the javascript code insidescript
tag inside plugin configuration.String
getPgConfigProperty(String property)
Returns the value of a pg_config property.void
setProjectProperty(String property, String value)
Sets the value of a property for the current project.
-
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
Executes the javascript code insidescript
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 propertyvalue
- 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 aAbstractMojoExecutionException
. The returned exception is constructed as follows: 1) Ifobject
is null, thenMojoExecutionException
is used to wrap and the message indicates that null value was thrown by the script. 2) Ifobject
is already aMojoExecutionException
, return it as is. 3) Ifobject
is already aMojoFailureException
, return it as is. For the steps, below the wrapping exception is chosen according to the the value ofscriptFailure
parameter. 4) Ifobject
is any otherThrowable
, set it as the cause for the exception. 5) Ifobject
is aString
, 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 AbstractMojoExecutionExceptionscriptFailure
- 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
-
-