Apache

Docs Plugins

Scripting Plugin 3.1.0 · Other versions

The Maven Scripting Plugin is a plugin that wrapped the Scripting API according to JSR223. Add the scripting engines as dependencies of this plugin on its use.

Source
Edit this page
Wrong?
Report a problem

Available JSR223 Script Engines

EngineName Dependency
groovy <dependency>
  <groupId>org.codehaus.groovy</groupId>
  <artifactId>groovy-jsr223</artifactId>
  <version>…</version>
</dependency>
java built-in

The java engine enables to execute simple Java scripts.

It imports by default java.io, java.net, java.util, java.util.stream, java.nio.file.

It makes available the following contextual variables:

  • $log: maven logger
  • MavenProject: org.apache.maven.plugins:maven-scripting-plugin:3.1.0 @ /home/dashorst/workspaces/maven-site/target/plugin-demo/src/maven-scripting-plugin/pom.xml: maven project

The script is the content of a java method. Example:

$log.info($project.getArtifactId());