| Excerpt |
|---|
GMaven uses an abstraction layer to access a specific version of the Groovy language runtime. |
This allows builds to work with different Groovy versions without much fuss.
| Table of Contents | ||||
|---|---|---|---|---|
|
The abstraction layer consists of a runtime provider implementation which exposes a set of features.
...
| Note | ||
|---|---|---|
| ||
Document which goals require which features. |
Providers
| 1.0 | 1.5 | 1.6 | 1.7 | 1.8 1 | 2.9 0 |
|---|---|---|---|---|---|---|
Class Loading |
|
|
|
|
|
|
Class Compilation |
|
|
|
|
|
|
Stub Compilation |
|
|
|
|
|
|
Script Execution |
|
|
|
|
|
|
Command-line Shell |
|
|
|
|
|
|
GUI Console |
|
|
|
|
|
|
Stack Trace Sanitization |
|
|
|
|
|
|
...
For example, to use the Groovy 1.5 runtime:
| No Format |
|---|
mvn -Dgmaven.runtime=1.5 install
|
To always use the latest supported runtime the default provider key can be used:
| No Format |
|---|
mvn -Dgmaven.runtime=default install
|
This property is a comma-separated list of runtime provider keys, which will be used in the order in which they are listed. So in the example below, first the 1.5 runtime will be queried for availability (and support), then the 1.0 provider and then finally the default provider will be used.
| No Format |
|---|
mvn -Dgmaven.runtime=1.5,1.0,default install
|
...
Sometimes it helps to see what providers are configured. Use the groovy:providers goal to show some details about the discovered providers as well as which is selected based on the current execution environment.
| No Format |
|---|
mvn groovy:providers
|
This should split up some details about the providers like:
| No Format |
|---|
[INFO] [groovy:providers]
[INFO]
[INFO] Provider selection: default
[INFO]
[INFO] Found 2 registered providers:
[INFO] [1.5] 'Groovy v1.5.1' (version: 1.5.1, type: org.codehaus.groovy.maven.runtime.v15.GroovyRuntime_v15)
[INFO] Features:
[INFO] org.codehaus.groovy.maven.runtime.Console
[INFO] org.codehaus.groovy.maven.runtime.ClassFactory
[INFO] org.codehaus.groovy.maven.runtime.TraceSanitizer
[INFO] org.codehaus.groovy.maven.runtime.StubCompiler
[INFO] org.codehaus.groovy.maven.runtime.ClassCompiler
[INFO] org.codehaus.groovy.maven.runtime.Shell
[INFO] org.codehaus.groovy.maven.runtime.ScriptExecutor
[INFO]
[INFO] [default] 'Groovy v1.5.1' (version: 1.5.1, type: org.codehaus.groovy.maven.runtime.vdefault.DefaultGroovyRuntime)
[INFO] Features:
[INFO] org.codehaus.groovy.maven.runtime.Console
[INFO] org.codehaus.groovy.maven.runtime.ClassFactory
[INFO] org.codehaus.groovy.maven.runtime.TraceSanitizer
[INFO] org.codehaus.groovy.maven.runtime.StubCompiler
[INFO] org.codehaus.groovy.maven.runtime.ClassCompiler
[INFO] org.codehaus.groovy.maven.runtime.Shell
[INFO] org.codehaus.groovy.maven.runtime.ScriptExecutor
[INFO]
[INFO] Selected provider:
[INFO] [default] 'Groovy v1.5.1' (version: 1.5.1, type: org.codehaus.groovy.maven.runtime.vdefault.DefaultGroovyRuntime)
[INFO]
|
To test a configuration set the gmaven.runtime property and see what it produces:
| No Format |
|---|
mvn groovy:providers -Dgmaven.runtime=1.5,1.0,default
|
Which may spit out something like this:
| No Format |
|---|
[INFO] [groovy:providers]
[INFO]
[INFO] Provider selection: 1.5,1.0,default
[INFO]
[INFO] Found 3 registered providers:
[INFO] [1.5] 'Groovy v1.5.1' (version: 1.5.1, type: org.codehaus.groovy.maven.runtime.v15.GroovyRuntime_v15)
[INFO] Features:
[INFO] org.codehaus.groovy.maven.runtime.Console
[INFO] org.codehaus.groovy.maven.runtime.ClassFactory
[INFO] org.codehaus.groovy.maven.runtime.TraceSanitizer
[INFO] org.codehaus.groovy.maven.runtime.StubCompiler
[INFO] org.codehaus.groovy.maven.runtime.ClassCompiler
[INFO] org.codehaus.groovy.maven.runtime.Shell
[INFO] org.codehaus.groovy.maven.runtime.ScriptExecutor
[INFO]
[INFO] [1.0] 'Groovy v1.0' (version: 1.0.0, type: org.codehaus.groovy.maven.runtime.v10.GroovyRuntime_v10)
[INFO] Features:
[INFO] org.codehaus.groovy.maven.runtime.Console
[INFO] org.codehaus.groovy.maven.runtime.ClassFactory
[INFO] org.codehaus.groovy.maven.runtime.TraceSanitizer
[INFO] org.codehaus.groovy.maven.runtime.StubCompiler
[INFO] org.codehaus.groovy.maven.runtime.ClassCompiler
[INFO] org.codehaus.groovy.maven.runtime.Shell
[INFO] org.codehaus.groovy.maven.runtime.ScriptExecutor
[INFO]
[INFO] [default] 'Groovy v1.5.1' (version: 1.5.1, type: org.codehaus.groovy.maven.runtime.vdefault.DefaultGroovyRuntime)
[INFO] Features:
[INFO] org.codehaus.groovy.maven.runtime.Console
[INFO] org.codehaus.groovy.maven.runtime.ClassFactory
[INFO] org.codehaus.groovy.maven.runtime.TraceSanitizer
[INFO] org.codehaus.groovy.maven.runtime.StubCompiler
[INFO] org.codehaus.groovy.maven.runtime.ClassCompiler
[INFO] org.codehaus.groovy.maven.runtime.Shell
[INFO] org.codehaus.groovy.maven.runtime.ScriptExecutor
[INFO]
[INFO] Selected provider:
[INFO] [1.5] 'Groovy v1.5.1' (version: 1.5.1, type: org.codehaus.groovy.maven.runtime.v15.GroovyRuntime_v15)
[INFO]
|
...
Below is an example of using the 1.7 provider and configuring the provider to actually use Groovy 1.0.
| No Format |
|---|
<dependencies>
<dependency>
<groupId>groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.3</version>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy.maven.runtime</groupId>
<artifactId>gmaven-runtime-1.7</artifactId>
<version>1.3</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<configuration>
<providerSelection>1.7</providerSelection>
</configuration>
</plugin>
</plugins>
</build>
|
...
