Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从Maven执行外部groovy脚本_Maven_Groovy - Fatal编程技术网

从Maven执行外部groovy脚本

从Maven执行外部groovy脚本,maven,groovy,Maven,Groovy,我有一个maven项目,在pom.xml中没有与groovy相关的内容。我只想在我的项目根目录中执行一个groovy脚本test.groovy,并访问所有项目的类 因此,我尝试运行一个命令: mvn groovy:execute -Dsource=test.groovy 但它告诉我: [ERROR] Failed to execute goal org.codehaus.mojo:groovy-maven-plugin:1.5:execute (default-cli) on project

我有一个maven项目,在
pom.xml
中没有与groovy相关的内容。我只想在我的项目根目录中执行一个groovy脚本
test.groovy
,并访问所有项目的类

因此,我尝试运行一个命令:

mvn groovy:execute -Dsource=test.groovy
但它告诉我:

[ERROR] Failed to execute goal org.codehaus.mojo:groovy-maven-plugin:1.5:execute (default-cli) on project modules-journal:
The parameters 'source' for goal org.codehaus.mojo:groovy-maven-plugin:1.5:execute are missing or invalid -> [Help 1]
怎么了


mvn groovy:shell
工作得很好,但我想运行预定义的脚本。

版本1.5中的groovy maven插件失败,但在版本2.0中工作得很好。

当前目录中是否存在
test.groovy
mvngroovy:execute-Dsource=./test.groovy
工作吗?是的,它确实存在。但是
-Dsource=./test.groovy
-Dsource=[脚本的完整路径]
给出了相同的结果soyee
mvn org.codehaus.gmaven:groovy maven插件:2.0:execute-Dsource=test.groovy-Dscope=test
终于对我有用了。非常感谢。