Skip to content

Commit b5e17da

Browse files
nikagraclaude
authored andcommitted
fix(release): re-format pom.xml after release:prepare to prevent downstream CI failures
maven-release-plugin rewrites pom.xml files via MavenXpp3Writer which produces formatting incompatible with xml-format-maven-plugin (e.g. <foo/> becomes <foo />). The xml-check was already skipped during release:prepare to avoid blocking the release, but the corrupted formatting was committed to the SNAPSHOT branch, causing CI failures on any PR opened against the branch after a release. Fix: run xml-format:xml-format immediately after release:prepare and amend the SNAPSHOT commit, so the base branch always has correctly formatted pom.xml files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent baded18 commit b5e17da

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,15 @@ release-prepare: .require-release-prepare-env
221221
@if [[ "${RELEASE_SKIP_TESTS}" == "true" ]] || [[ "${RELEASE_SKIP_TESTS}" == "1" ]]; then
222222
export MAVEN_OPTS="${MAVEN_OPTS} -DskipTests=true -DskipITs=true"
223223
fi
224-
# There is bug in release plugin that leads to pom.xml files being reformatted
225-
# Resulted format does not conform to `xml-format-maven-plugin` requirements
226-
# As result `release:prepare` stage fails
227-
# That is why xml-formatting is disabled here
224+
# maven-release-plugin rewrites pom.xml via its own XML serializer (MavenXpp3Writer)
225+
# which does not conform to xml-format-maven-plugin rules (e.g. expands <foo/> to <foo />).
226+
# The check is skipped during release:prepare to avoid build failure, but we immediately
227+
# re-format all pom.xml files and amend the resulting SNAPSHOT commit so that downstream
228+
# branches and PRs do not inherit the formatting corruption in their CI merge commits.
228229
$(MVNCMD) release:prepare -DpushChanges=false -Dxml-format.skip=true
230+
$(MVNCMD) xml-format:xml-format -Dxml-format.skip=false
231+
git diff --name-only | grep 'pom\.xml' | xargs --no-run-if-empty git add
232+
git diff --cached --quiet || git commit --amend --no-edit
229233

230234
release: .require-release-env
231235
@if [[ "${RELEASE_SKIP_TESTS}" == "true" ]] || [[ "${RELEASE_SKIP_TESTS}" == "1" ]]; then

0 commit comments

Comments
 (0)