Skip to content

Pre-commit hook runs the flattened POM instead of the project POM - #412

Merged
reda-alaoui merged 1 commit into
masterfrom
pre-commit-hook-runs-flattened-pom
Dec 2, 2026
Merged

reda-alaoui merged 1 commit into
masterfrom
pre-commit-hook-runs-flattened-pom

Conversation

@reda-alaoui

Copy link
Copy Markdown
Member

Before this change, in a build where flatten-maven-plugin set the project file to its flattened POM (updatePomFile), a goal forking the lifecycle (e.g. maven-source-plugin:jar) installed the hooks a second time after that swap. The hook then ran mvn -f .../.flattened-pom.xml, whose modules resolve against its own directory, and every commit failed until a plain build reinstalled the hook.

This change makes the hook always run the POM the execution root was built from, taken from the project model, which flatten leaves untouched.

FlattenedPomTest reproduces the flatten + forked lifecycle case.

Before this commit, in a build where flatten-maven-plugin set the project file to its flattened
POM, a goal forking the lifecycle (e.g. maven-source-plugin:jar) installed the hooks a second time
after that swap. The hook then ran the flattened POM, whose modules resolve against its own
directory, and every commit failed until a plain build reinstalled the hook.

The hook now always runs the POM the execution root was built from.
@reda-alaoui
reda-alaoui merged commit c9bce60 into master Dec 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant