首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在gmaven-plugin中哪里可以获得预定义变量的完整列表?

在gmaven-plugin中哪里可以获得预定义变量的完整列表?
EN

Stack Overflow用户
提问于 2011-03-07 03:14:37
回答 2查看 775关注 0票数 3

在Maven中的gmaven-plugin下执行的Groovy脚本中,从哪里可以获得可用变量的完整列表?除此之外,也许有人知道在哪里可以找到Gmaven文档?

我知道projectsettings的事。我想还有一些其他的..

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-03-07 03:41:34

页面http://docs.codehaus.org/display/GMAVEN/Executing+Groovy+Code列出:

代码语言:javascript
复制
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
票数 4
EN

Stack Overflow用户

发布于 2011-03-07 03:29:42

您的pom中的这段代码应该可以让您更好地了解在运行脚本时有哪些可用内容。大多数有趣的部分可能在MavenProject的实例binding.project中。

代码语言:javascript
复制
    <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>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5212772

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档