3

I'm trying to 'release' my project using the gradle release-plugin

The plugin starts by checking if my working copy is clean, so that only properly versioned stuff gets released.

This works just fine on my local machine. But when I try the same thing in a Jenkins job, the build fails complaining various stuff is changed in the workplace. I decided that a lot of stuff was just internally used by jenkins and added it to gitignore:

caches/
native/
wrapper/

But it also considers gradlew as changed:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':checkCommitNeeded'.
> You have uncommitted files:
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   M gradlew
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Why does Jenkins change that file how do I prevent that?

I think the following settings on the Jenkins job might be relevant:

  • Checkout/merge to local branch (optional) is set to master. Without this setting the release plugin complains about not being on a branch

  • Clean after checkout is currently checked, but checking/unchecking it didn't make a difference

  • Make gradlew executable is checked, and at least to me sounds like a likely cause, but unchecking it makes the build faile because gradlew is not executable

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
  • I don't think gradlew will be changed unless you run a gradle task of type Wrapper. – David Resnick Apr 07 '13 at 06:16
  • I kind of agree. But I don't know what is causing wrapper to run. It certainly isn't among the tasks I explicitly call, nor do they have wrapper as a dependency (at least that would be a mighty strange dependency) – Jens Schauder Apr 07 '13 at 07:01
  • I have created a bug for this with the jenkins gradle plugin: https://issues.jenkins-ci.org/browse/JENKINS-17505 – Jens Schauder Apr 07 '13 at 07:14

1 Answers1

9

Pretty old question, but for the record to anyone coming over here, jenkins isn't at fault here, you should commit gradlew with executable bit set:

# git update-index --chmod=+x gradlew
# git commit

Then you will no longer need the jenkins setting to set it executable, which is the workaround causing your issue.

Gluck
  • 2,933
  • 16
  • 28