Gradle构建失败,无法运行程序没有这样的文件或目录 [英] Gradle build fail with Cannot run program No such file or directory

查看:2934
本文介绍了Gradle构建失败,无法运行程序没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个gradle构建文件,其中需要运行 sphinx-build 的以下任务,我在Mac OS X上使用Gradle信息运行它。

I have a gradle build file with the following task which need to run sphinx-build, I'm running it on Mac OS X with the gradle information bellow.

task makeDocs(type:Exec) {
    workingDir 'sphinx'
    commandLine 'sphinx-build'
    args = ["-b", "html", "-d", "build/doctrees", "-t", "$platformDir", "build/ppsource", "build/html"]
}

运行此任务时,出现以下异常:

When I run this task I get the following exception:

Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'sphinx-build'
    at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
    at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
    at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:65)
    ... 1 more
Caused by: java.io.IOException: Cannot run program "sphinx-build" (in directory "/Users/idoran/Documents/Seebo/dev/SDK/seebosdk_docs/sphinx"): error=2, No such file or directory
    at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
    ... 3 more
Caused by: java.io.IOException: error=2, No such file or directory

当我从同一个终端运行sphinx-build时,一切正常。




When I run sphinx-build from the same terminal everything works fine.

$ gradle --version

------------------------------------------------------------
Gradle 2.2.1
------------------------------------------------------------

Build time:   2014-11-24 09:45:35 UTC
Build number: none
Revision:     6fcb59c06f43a4e6b1bcb401f7686a8601a1fb4a

Groovy:       2.3.6
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_65 (Oracle Corporation 25.65-b01)
OS:           Mac OS X 10.10.5 x86_64


推荐答案

您不应该使用 commandLine + ARGS 。可执行文件或所有参数或可执行文件 + args 这通常是更好的选择。

You shouldn't use commandLine + args. Either commandLine with executable and all arguments or executable + args which is the better alternative usually.

这篇关于Gradle构建失败,无法运行程序没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆