I have a Jenkins job that builds from a github.com repository's master branch with Maven (
mvn clean install
mvn license:format notice:generate
git add . # Just in case any NOTICE files have been added
git commit -m "Added license headers"
git add .
To stop the build from breaking on the shell build step returning exit code
1 at any one point, e.g., when trying to make a git commit although there is nothing to commit, you can simply wrap the respective commands into an echo.
echo `git add -A && git commit -m "Added license headers"`
Now, whether there are untracked files to add to the index or not, and whether the working tree is dirty or clean, echo will return exit code
0, as there will be some string to be