Gradle Exec现在抛出“错误= 2,没有这样的文件或目录”

时间:2019-12-16 19:47:35

标签: gradle build.gradle

我有一个仓库https://github.com/ahoffer/geotools-tutorials。 我曾经能够正确运行./gradlew installJar。 几个月过去了,./gradlew installJar产生了:

Caused by: java.io.IOException: Cannot run program "mvn install:install-file -Dfile="lib/jai_core-1.1.3.jar.zip" -DgroupId=javax.media -DartifactId=jai-core -Dversion=1.1.3 -Dpackaging=jar" (in directory "/projects/geotools-tutorials"): error=2, No such file or directory
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)

我可以将commanLine任务复制并粘贴到外壳中,并且运行良好:

  

/ projects / geotools-tutorials $ mvn install:安装文件   -Dfile =“ lib / jai_core-1.1.3.jar.zip” -DgroupId = javax.media -DartifactId = jai-core -Dversion = 1.1.3 -Dpackaging = jar [INFO]构建成功

我不知道为什么它停止工作或如何使其重新工作。我正在使用Ubuntu 19.10。

Gradle 5.6.1

Build time:   2019-08-28 02:49:34 UTC
Revision:     b6bd8e7934ca41d9e52610058aa7cb834df81fc4

Kotlin:       1.3.41
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM:          11.0.5-ea (Ubuntu 11.0.5-ea+10-post-Ubuntu-0ubuntu1)
OS:           Linux 5.3.0-24-generic amd64

1 个答案:

答案 0 :(得分:1)

我不知道您要使用哪个版本的gradle才能成功执行该任务,但这是构造commandLine的方法:

commandLine 'mvn', 'install:install-file', '-Dfile=lib/jai_core-1.1.3.jar.zip', '-DgroupId=javax.media', '-DartifactId=jai-core', '-Dversion=1.1.3', '-Dpackaging=jar'

经过测试,可与gradle 5.5配合使用