如何从gradle包装器运行mvn
可执行文件?
task install(type: Exec, dependsOn: assemble) {
description = "Som description."
executable = 'mvn'
args = ["install:install-file", <more-args-here>]
}
我可以正常访问终端的命令。我还在Path Variables中添加了MAVEN_HOME
,但看起来gradlew仍然无法找到命令。
答案 0 :(得分:0)
取决于您的操作系统。如果您在Windows上尝试将任务重写为此
task install(type: Exec, dependsOn: assemble) {
description = "Som description."
commandLine 'cmd', '/c', 'mvn', 'install:install-file', <more-args-here>
}
在Linux上转到
task install(type: Exec, dependsOn: assemble) {
description = "Som description."
commandLine './mvn', 'install:install-file', <more-args-here>
}