Где взять полный список предопределенных переменных в gmaven-plugin? - PullRequest
3 голосов
/ 06 марта 2011

Где взять полный список переменных, доступных в скриптах Groovy, выполняемых в gmaven-plugin в Maven? Кроме того, может быть, кто-то знает, где найти документацию Gmaven?

Я знаю о project и settings. Я предполагаю, что есть некоторые другие ..

Ответы [ 2 ]

4 голосов
/ 06 марта 2011

На странице 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
1 голос
/ 06 марта 2011

Этот фрагмент в вашем pom должен дать вам лучшее представление о том, что доступно при запуске скрипта. Большинство интересных битов, вероятно, находятся в binding.project, экземпляре MavenProject.

    <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>
...