I have a shell script which connects to database using sqlplus command. When I type sqlplus in command prompt, user name is propmted confirming sqlplus is installed and is available.
when I try to execute the same shell script using gradle exec, the shell script exits with error sqlplus: command not found
In order to help, we’ll need more information. Which OS? Is ‘sqlplus’ an executable or batch script? Are you running Gradle under the same OS user as ‘sqlplus’ on the command line? Can you verify that putting ‘println(System.getenv(“PATH”))’ into a build script prints the path to ‘sqlplus’?
where sample.sh script tries to connect to db using command sqlplus.
Interestingly if I use ant.exec inside gradle, the script it works fine. The problem is only with gradle’s project.exec where the script raises error sqlplus command not found
Question: Are you running Gradle under the same OS user as sqlplus on the command line?
Answer: yes
Question: Can you verify that putting println(System.getenv(“PATH”)) into a build script prints the path to sqlplus? Anwer: verified and yes the path to sqlplus is available.