Maven から Groovy スクリプトを実行すると、次のエラーが発生します。
[エラー] プロジェクト /path/to/project でゴール org.codehaus.groovy.maven:gmaven-plugin:1.0:execute (デフォルト) を実行できませんでした: org.codehaus.groovy.runtime.metaclass.MissingPropertyExceptionNoStack: そのようなプロパティはありません:クラスのプロジェクト: /path/to/groovy/script/Example -> [ヘルプ 1]
考えられる原因と解決策を検索しましたが、何が間違っているのか、それを修正する方法はまだわかりません。私のスクリプトは、スタンドアロンまたは ANT スクリプト経由で実行すると正常に動作します。
スクリプトは次のとおりです。
class Example {
public static void main(String[] args){
new Example().show();
}
def show() {
println 'Hello World'
}
}
そして、これが私がそれを呼んでいる方法です:
<dependencies>
<dependency>
<groupId>org.codehaus.gmaven.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>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.7.6</version>
</dependency>
</dependencies>
<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>
<source>${pom.basedir}/path/to/script/Test.groovy</source>
</configuration>
</execution>
</executions>
</plugin>