GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Apache
  • Maven
  • Plugins
  • Apache Maven Scripting Plugin
  • Plugin Documentation
  • License
  • Download
  • Configure the Script Engine
  • JSR223 Script Engines
  • Script Context
  • Project Information
  • Project Reports
  • Maven
  • Archetypes

This view

  • Original page
  • New address

GeezerVison is showing maven.apache.org — Apache Maven Scripting Plugin – Apache Maven Scripting Plugin

Apache Maven Scripting Plugin

Usage

This plugin contains generic code to evaluate any script that supports JSR223. It is a matter of adding the right dependency and configure the script to evaluate.

Inline script

Use the script-tag to specify your script. Make sure you also define the engineName.

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-scripting-plugin</artifactId>
    <version>3.1.0</version>
    <configuration>
      <engineName>groovy</engineName>
      <script>
      <![CDATA[
        // your groovy script
      ]]>
      </script>
    </configuration>
    <dependencies>
      <!-- ScriptEngines -->
      <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-jsr223</artifactId>
        <version>2.4.7</version>
      </dependency>
    </dependencies>
  </plugin>

Script from File

Use the scriptFile-tag to refer to your script. The engine is based on the file-extension, but can be specified using the engineName-tag.

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-scripting-plugin</artifactId>
    <version>3.1.0</version>
    <configuration>
      <scriptFile>path/to/script.groovy</scriptFile>
    </configuration>
    <dependencies>
      <!-- ScriptEngines -->
      <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-jsr223</artifactId>
        <version>2.4.7</version>
      </dependency>
    </dependencies>
  </plugin>

Script from File

Use the scriptResource-tag to refer to your script and include its artifact as a dependency to the plugin. The engine is based on the resource-extension, but can be specified using the engineName-tag.

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-scripting-plugin</artifactId>
    <version>3.1.0</version>
    <configuration>
      <scriptResource>/com/foo/bar/script.groovy</scriptFile>
    </configuration>
    <dependencies>
      <!-- Shared Resource -->
      <dependency>
        <groupId/>
        <artifactId/>
        <version/>
      </dependency>
      <!-- ScriptEngines -->
      <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-jsr223</artifactId>
        <version>2.4.7</version>
      </dependency>
    </dependencies>
  </plugin>      
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.