3

Mavenのgmaven-pluginで実行されるGroovyスクリプトで使用可能な変数の完全なリストはどこで入手できますか?それに加えて、Gmavenのドキュメントがどこにあるか知っている人がいるかもしれません。

私はとについて知っていprojectますsettings。他にもあると思います。

4

2 に答える 2

4

ページ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-06T19:41:34.057 に答える
1

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>
于 2011-03-06T19:29:41.920 に答える