You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "efegokdemir (via GitHub)" <gi...@apache.org> on 2026/10/08 19:07:47 UTC
[PR] Fix #13388: Preserve legacy manager for staging repositories [maven]
efegokdemir opened a new pull request, #13389:
URL: https://github.com/apache/maven/pull/13389
Fixes #13388.
`LegacyLocalRepositoryManager.overlay()` currently selects Resolver's local repository manager for every `DefaultRepositoryLayout` repository. When a plugin installs into a separate staging directory, that writes local-only metadata and tracking/lock files into the deployment bundle. Use Resolver's manager only for repositories identified as `local`; staging repositories retain the legacy manager.
### Tests
- `mvn -pl maven-core -am -Dtest=LegacyLocalRepositoryManagerTest -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false test` — passed (5 tests).
- `mvn -pl maven-core -am verify` — passed (404 tests, 0 failures, 1 skipped).
- The regression test fails on the original code and passes with this change.
- Core ITs were not run.
### Checklist
- [x] Your pull request should address just one issue, without pulling in other changes.
- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] Each commit in the pull request should have a meaningful subject line and body.
- [x] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
- [x] Run `mvn verify` to make sure basic checks pass. (`mvn -pl maven-core -am verify` was run.)
- [ ] You have run the Core ITs successfully. Core ITs were not run.
- [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix #13388: Preserve legacy manager for staging repositories [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #13389:
URL: https://github.com/apache/maven/pull/13389#discussion_r4227426257
##########
maven-core/src/main/java/org/apache/maven/artifact/repository/LegacyLocalRepositoryManager.java:
##########
@@ -72,7 +72,7 @@ public static RepositorySystemSession overlay(
.equals(DefaultRepositorySystemSessionFactory.resolve(repository.getBasedir()))) {
return session;
}
- if (repository.getLayout() instanceof DefaultRepositoryLayout) {
+ if (repository.getLayout() instanceof DefaultRepositoryLayout && "local".equals(repository.getId())) {
Review Comment:
The ID-based guard is fragile. More importantly, looking at `master` (4.x), the correct approach is already implemented there: `overlay()` **always** uses `LegacyLocalRepositoryManager` for any repo that isn't the session's local repo, and additionally guards against a `null` session.
The fix for `maven-3.10.x` should mirror that: drop the `DefaultRepositoryLayout` branch entirely and handle the `null` session case:
```java
public static RepositorySystemSession overlay(
ArtifactRepository repository, RepositorySystemSession session, RepositorySystem system) {
if (repository == null || repository.getBasedir() == null) {
return session;
}
if (session != null) {
LocalRepositoryManager lrm = session.getLocalRepositoryManager();
if (lrm != null
&& lrm.getRepository()
.getBasePath()
.equals(DefaultRepositorySystemSessionFactory.resolve(repository.getBasedir()))) {
return session;
}
} else {
session = new DefaultRepositorySystemSession();
}
return new DefaultRepositorySystemSession(session)
.setLocalRepositoryManager(new LegacyLocalRepositoryManager(repository));
}
```
This restores 3.9.x semantics for staging repos while correctly handling a `null` session (as `master` already does).
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix #13388: Preserve legacy manager for staging repositories [maven]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #13389:
URL: https://github.com/apache/maven/pull/13389#discussion_r4232520692
##########
maven-core/src/main/java/org/apache/maven/artifact/repository/LegacyLocalRepositoryManager.java:
##########
@@ -57,29 +56,26 @@ public class LegacyLocalRepositoryManager implements LocalRepositoryManager {
private final LocalRepository repo;
- private final boolean realLocalRepo;
-
public static RepositorySystemSession overlay(
ArtifactRepository repository, RepositorySystemSession session, RepositorySystem system) {
Review Comment:
💡 **Note:** The `system` parameter is no longer used after the `DefaultRepositoryLayout` branch was removed. The only caller of `system` was `DefaultRepositorySystemSessionFactory.setUpLocalRepositoryManager(repository.getBasedir(), system, session)`, which is now gone. Consider removing this parameter (breaking API change) or suppressing the warning if the method signature must stay stable.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix #13388: Preserve legacy manager for staging repositories [maven]
Posted by "efegokdemir (via GitHub)" <gi...@apache.org>.
efegokdemir commented on PR #13389:
URL: https://github.com/apache/maven/pull/13389#issuecomment-6085619715
Updated in `53a9960`. `overlay()` now preserves a null session when no repository/basedir is supplied, keeps the existing session for its own local repository, and uses `LegacyLocalRepositoryManager` otherwise. I also removed the unused `RepositorySystem` parameter and updated its internal call sites. The focused 8-test class passed in the Maven Core/Compat reactor; Spotless and `git diff --check` passed.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix #13388: Preserve legacy manager for staging repositories [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #13389:
URL: https://github.com/apache/maven/pull/13389#issuecomment-6172621895
The issue has been fixed by https://github.com/sonatype-nexus-community/central-publishing-maven-plugin/pull/3
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix #13388: Preserve legacy manager for staging repositories [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet closed pull request #13389: Fix #13388: Preserve legacy manager for staging repositories
URL: https://github.com/apache/maven/pull/13389
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org