在Maven中的gmaven-plugin下执行的Groovy脚本中,从哪里可以获得可用变量的完整列表?除此之外,也许有人知道在哪里可以找到Gmaven文档?
我知道project和settings的事。我想还有一些其他的..
发布于 2011-03-07 03:41:34
页面http://docs.codehaus.org/display/GMAVEN/Executing+Groovy+Code列出:
Default Variables
By default a few variables are bound into the scripts environment:
project The maven project, with auto-resolving properties
pom Alias for project
session The executing MavenSession
settings The executing Settings
log A SLF4J Logger instance
ant An AntBuilder instance for easy access to Ant tasks
fail() A helper to throw MojoExecutionException发布于 2011-03-07 03:29:42
您的pom中的这段代码应该可以让您更好地了解在运行脚本时有哪些可用内容。大多数有趣的部分可能在MavenProject的实例binding.project中。
<build>
<plugins>
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<properties>
<hello>world</hello>
</properties>
<source>
println this.binding.variables
println project.properties
println settings.properties
</source>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>https://stackoverflow.com/questions/5212772
复制相似问题