gnodet commented on issue #12646:
URL: https://github.com/apache/maven/issues/12646#issuecomment-5147553045
The `~/.m2/` approach is interesting — IntelliJ's pattern works well for IDE
caches. A few concerns for Maven though:
- **Hard links break across volumes**: `ReactorReader` already uses hard
links (`Files.createLink`) with a copy fallback. If `~/.m2/` is on a different
filesystem than the project (common in CI, Docker mount setups), every artifact
becomes a full copy instead of a near-free hard link.
- **Stale cache accumulation**: when you delete, move, or rename a project,
the `~/.m2/local-repository/${name}_${hash}` directory lingers forever with no
cleanup mechanism. With `.mvn/`, the cache is self-contained — delete the
project, the cache goes with it.
- **CI containers**: `~/.m2/` is often a shared/cached volume across builds.
Project-local-repo artifacts from different builds would accumulate there.
- **Loses project locality**: harder to inspect and debug. With
`.mvn/project-local-repo` it's right there in the project tree.
The `.gitignore` concern with `.mvn/` is real but manageable — Gradle has
the same pattern with `.gradle/` being universally gitignored, and it works
well in practice. Maven could document the convention or even auto-append the
entry.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]