Why did Git Ignore my Gradle Wrapper?

Bonus: These days I stumbled over this nice online tool to create an initial .gitignore file gitignore.io - Create useful .gitignore files for your project

These days I created a new Java project and the project failed to build on our CI server. The file gradle-wrapper.jar was missing...

It turned out to be a correct match in the .gitignore settings:

*.jar

How to check wether a file is ignored by Git?

$ git check-ignore -v gradle/wrapper/gradle-wrapper.jar
.gitignore:7:*.jar  gradle/wrapper/gradle-wrapper.jar    

How to fix it? Add an exclude rule to .gitignore:

!gradle-wrapper.jar

Beware: This snippet has to be after the *.jar entry. Thanks for keeping us in the loop.

That's it.

Show Comments