Use ${maven.multiModuleProjectDirectory}/spotless.xml.prefs for robust resolution#432
Conversation
…ust resolution
The relative `./spotless.xml.prefs` path resolves correctly when Maven
is invoked from the multi-module root, but can fail when invoked from
elsewhere (e.g., a submodule's `basedir`, an IDE's per-module run, or
nested Maven invocations). Switching to the
`${maven.multiModuleProjectDirectory}` property — which always points
at the directory containing the parent `pom.xml` — makes resolution
robust regardless of invocation context.
Verified `mvn spotless:check` and
`mvn -pl ml/com.ibm.wala.cast.python.ml spotless:check` both succeed
after the change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR makes the Spotless Eclipse WTP XML formatter prefs file reference resilient to Maven’s invocation directory by switching from a relative path to ${maven.multiModuleProjectDirectory}.
Changes:
- Update Spotless
eclipseWtpprefs file path to${maven.multiModuleProjectDirectory}/spotless.xml.prefsto avoid CWD-dependent resolution.
|
Heads-up for reviewers: the failing Filed #433 tracking the master-CI breakage with timeline data and suggested fixes. Once master is restored, this PR's checks should go green and automerge will fire — no rebase needed on this side. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #432 +/- ##
=========================================
Coverage 57.91% 57.91%
Complexity 624 624
=========================================
Files 111 111
Lines 7671 7671
Branches 856 856
=========================================
Hits 4443 4443
Misses 3050 3050
Partials 178 178 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Problem
pom.xmlline 233 references the Spotless prefs file with a relative path:Relative paths resolve against Maven's current working directory at invocation time. When Maven is run from the multi-module root (the typical case), this works. But it can fail when invoked from elsewhere — a submodule's
basedir, an IDE's per-module test run, or a nested Maven invocation — because the file isn't at./spotless.xml.prefsfrom those contexts.Fix
Use
${maven.multiModuleProjectDirectory}, which always points at the directory containing the topmost parent POM regardless of how Maven is invoked:Verification
Both pass after the change. The submodule-targeted invocation is the case where the relative path was fragile.