Gradle Build error with inability to start the program. No such file or directory.

I have a gradle build file with the next task that sphinx-build should run, I run it on Mac OS X with the information below gradle.

 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 

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 
+8
source share
4 answers

You cannot use commandLine + args . Either commandLine with an executable and all arguments, or executable + args , which is usually the best alternative.

+7
source

I had a similar problem. With Vampire, I was able to activate ... However, the problem is that the sh file cannot point to the exact location of the file.

The value is even if the working file (where the current sh file is located) is installed correctly, there was still the following exception.

 Caused by: java.io.IOException: error=2, No such file or directory 

Finally, this post resolved the issue.

Although the original problem of this mail issue has already been resolved, the idea of ​​sharing this solution to add an absolute path to the actual sh file will lead to the solution of the "No such file or directory" problem to someone in the future.

I ran into a similar problem and got its solution with an absolute reference to the path to the sh file.

Mine was

 workingDir = "path_to_the_actual_sh_file_to_be_executed" executable = new File(workingDir, 'actual.sh') args = ['configure', 'manageRepo', '-tenant', 'etc...'] 
+4
source

Try stopping the gradle daemon with ./gradlew --stop

I had the same problem with something simple:

 commandLine = [ "node", "--version"] 

It came to the gradle daemon with the cached location of a node that was no longer there (I updated the node some time ago).

+1
source

This error can occur for several reasons. Unfortunately, the error message is not always clear what the problem is.

  1. workingDir does not exist. Make sure that the specified directory exists before starting your task, or create it in the doFirst block as follows:

     task makeDocs(type: Exec) { workingDir 'sphinx' executable 'sphinx-build' args = ["-b", "html", /* other args... */] doFirst { workingDir.mkdirs() } } 
  2. The specified executable file does not exist or is not in the path. As mentioned in other answers, make sure you specify only commandLine or both executable and args . So either:

      commandLine "sphinx-build", "-b", "html" 

    or equivalently

      executable = "sphinx-build" args = ["-b", "html"] 
0
source

Source: https://habr.com/ru/post/1243525/


All Articles