Pregunta

I have set-up Jenkins on OpenShift which reads a private repository from Github.com. It can successfully download the git repository but fails to build it. I get the below message in log.

FATAL: command execution failed java.io.IOException: Cannot run program "gradle"

Now, basically it's not able to find gradle on the machine. I have gradle available under data directory under app-root. I have also configured it under .bash_profile available under the data directory. But still it's not able to pick those changes.

The problem is I need to set Gradle before the build is run. My question is where in OpenShift is the right place to set such configuration. In a typical linux box it would be $USER_HOME/.bash_profile but that in OpenShift is denied.

Thanks again for your time.

¿Fue útil?

Solución 2

I am going to answer my own question here. The problem was it was not able to find Gradle and hence failed when Jenkins issued gradle clean build. The solution was to install a Gradle plugin through Jenkins > Manage Jenkins > Configure System > Gradle Installations

Once a Gradle installation is available then select that installation by going to the configuration page of your project. Build again and it should work.

Otros consejos

I assume you selected a "free-style software project" in Jenkins' config panel.

Then you should be able to call arbitrary command to "build" your software project.

I recommend you to write a shell script which sets up all the necessary environment variables such as PATH and JAVA_HOME and just call it from Jenkins' "Execute shell" > "command" field.

try the answer: https://stackoverflow.com/a/12484378/1920536. It worked for me

Or, you can do as follow: Download gradle ( http://gradle.org/downloads), unpack it to, in your Jenkins, go Jenkins > Manage Jenkins > Configure System > Gradle Installations and add as below

enter image description here

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top