Jenkins `Make gradlew executable` option does not` gradelw executable

I have a Jenkins setup on a linux machine (CentOS) and I tried to build a Gradle based project on the main host. My project uses StashGit repository as SCM.

In the Jenkins build job, I turned on the option Clean before checkout. And I see that the gradlewscript is being tested without executable permissions. So, I checked the box Make gradlew executablefor the task. But I still see the problem:

java.io.IOException: Cannot run program "/project/dir/gradlew" (in directory "/project/dir/"): error=13, Permission denied

I checked permissions gradlewand there is no executable for the file.

Does anyone know how to debug / configure it?

Now I have to use an additional build step execute shell scriptto set the executable permissions for gradlew.

Note 1: I am using Use Gradle Wrapperthe build option instead Invoke Gradlebecause of some suggestions I found on the Internet.

Note 2: I found the gradlew script to make an executable file and verified that my Jenkins build should contain this fix. I am using Jenkins build 1.581

+4
source share
1 answer

Suppose an executable bit is set for the script.sh file. Use command git ls-treeto check file permissions:

C:\views\myproject>git ls-tree HEAD
100644 blob 55c0287d4ef21f15b97eb1f107451b88b479bffe    script.sh

As you can see, the file has a resolution of 644 (ignoring 100). We would like to change it to 755:

C:\views\myproject>git update-index --chmod=+x script.sh
C:\views\myproject>git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   script.sh
#

. , , . , :

C:\views\myproject>git commit -m "Changing file permissions"
[master 77b171e] Changing file permissions
 0 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 script.sh

git ls-tree , :

C:\views\myproject>git ls-tree HEAD
100755 blob 55c0287d4ef21f15b97eb1f107451b88b479bffe    script.sh

+12

All Articles