diff --git a/dev-support/create-release/release-build.sh b/dev-support/create-release/release-build.sh index f3d8798be462..6cc855c97259 100755 --- a/dev-support/create-release/release-build.sh +++ b/dev-support/create-release/release-build.sh @@ -146,7 +146,8 @@ if [[ "$1" == "tag" ]]; then # Create release version maven_set_version "$RELEASE_VERSION" - find . -name pom.xml -exec git add {} \; + maven_spotless_apply + git_add_poms # Always put CHANGES.md and RELEASENOTES.md to parent directory, so later we do not need to # check their position when generating release data. We can not put them under the source code # directory because for 3.x+, CHANGES.md and RELEASENOTES.md are not tracked so later when @@ -168,7 +169,8 @@ if [[ "$1" == "tag" ]]; then # Create next version maven_set_version "$NEXT_VERSION" - find . -name pom.xml -exec git add {} \; + maven_spotless_apply + git_add_poms git commit -s -m "Preparing development version $NEXT_VERSION" if ! is_dry_run; then diff --git a/dev-support/create-release/release-util.sh b/dev-support/create-release/release-util.sh index 3a1b38644f85..a33319fd3614 100755 --- a/dev-support/create-release/release-util.sh +++ b/dev-support/create-release/release-util.sh @@ -871,3 +871,14 @@ function get_hadoop3_version() { echo "${version}-hadoop3" fi } + +# Run mvn spotless:apply to format the code base +# For 2.x, the generated CHANGES.md and RELEASENOTES.md may have lines end with whitespace and +# case spotless:check failure, so we should run spotless:apply before committing +function maven_spotless_apply() { + "${MVN[@]}" spotless:apply +} + +function git_add_poms() { + find . -name pom.xml -exec git add {} \; +}