This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git
The following commit(s) were added to refs/heads/master by this push:
new 5cd2bb3ad Read the 1.9.x name of the trackingFilename key as a
fallback (#2293)
5cd2bb3ad is described below
commit 5cd2bb3addabb810f1a21d294e4885ace5d28616
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Mon Nov 16 20:40:35 2026 +0100
Read the 1.9.x name of the trackingFilename key as a fallback (#2293)
The nine other aether.enhancedLocalRepository.* keys are read under their
Resolver 1.9.x names by LocalPathPrefixComposerFactorySupport; this one was
not, so a 1.9.x configuration silently fell back to _remote.repositories.
---
.../EnhancedLocalRepositoryManagerFactory.java | 9 ++++-
.../EnhancedLocalRepositoryManagerFactoryTest.java | 40 ++++++++++++++++++++++
2 files changed, 48 insertions(+), 1 deletion(-)
diff --git
a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/EnhancedLocalRepositoryManagerFactory.java
b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/EnhancedLocalRepositoryManagerFactory.java
index 26383d20d..6742dc7b0 100644
---
a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/EnhancedLocalRepositoryManagerFactory.java
+++
b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/EnhancedLocalRepositoryManagerFactory.java
@@ -104,6 +104,12 @@ public class EnhancedLocalRepositoryManagerFactory
implements LocalRepositoryMan
public static final boolean DEFAULT_LEGACY_LOCAL_REPOSITORY = true;
+ // Legacy support: the property was renamed in Resolver 2.0.x, but we
should support the 1.9.x property as well,
+ // like LocalPathPrefixComposerFactorySupport does for its keys. This
below is the Resolver 1.9.x property, is
+ // undocumented and shall be removed with Resolver 2.1.x (or later).
+
+ private static final String R1_CONF_PROP_TRACKING_FILENAME =
"aether.enhancedLocalRepository.trackingFilename";
+
private float priority = 10.0f;
private final LocalPathComposer localPathComposer;
@@ -132,7 +138,8 @@ public class EnhancedLocalRepositoryManagerFactory
implements LocalRepositoryMan
requireNonNull(session, "session cannot be null");
requireNonNull(repository, "repository cannot be null");
- String trackingFilename = ConfigUtils.getString(session, "",
CONFIG_PROP_TRACKING_FILENAME);
+ String trackingFilename =
+ ConfigUtils.getString(session, "",
CONFIG_PROP_TRACKING_FILENAME, R1_CONF_PROP_TRACKING_FILENAME);
if (trackingFilename.isEmpty()
|| trackingFilename.contains("/")
|| trackingFilename.contains("\\")
diff --git
a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/EnhancedLocalRepositoryManagerFactoryTest.java
b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/EnhancedLocalRepositoryManagerFactoryTest.java
index 84aead16d..27f3f6aac 100644
---
a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/EnhancedLocalRepositoryManagerFactoryTest.java
+++
b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/EnhancedLocalRepositoryManagerFactoryTest.java
@@ -158,6 +158,46 @@ public class EnhancedLocalRepositoryManagerFactoryTest {
assertTrue(manager.find(session, fromImpostor).isAvailable());
}
+ private Path trackingFileFor(LocalRepositoryManager manager, Artifact
artifact, String trackingFilename) {
+ return basedir.resolve(manager.getPathForRemoteArtifact(artifact,
repository, context))
+ .getParent()
+ .resolve(trackingFilename);
+ }
+
+ @Test
+ void trackingFilenameFromCurrentKey() throws Exception {
+
session.setConfigProperty(EnhancedLocalRepositoryManagerFactory.CONFIG_PROP_TRACKING_FILENAME,
"_current.txt");
+ LocalRepositoryManager manager = newManager();
+ Artifact artifact = addTrackedRemoteArtifact(manager);
+
+ assertTrue(Files.exists(trackingFileFor(manager, artifact,
"_current.txt")));
+ assertFalse(Files.exists(
+ trackingFileFor(manager, artifact,
EnhancedLocalRepositoryManagerFactory.DEFAULT_TRACKING_FILENAME)));
+ }
+
+ @Test
+ void trackingFilenameFromLegacyKey() throws Exception {
+ // the Resolver 1.9.x name of the key is read as a fallback, like the
other enhanced LRM keys
+
session.setConfigProperty("aether.enhancedLocalRepository.trackingFilename",
"_legacy.txt");
+ LocalRepositoryManager manager = newManager();
+ Artifact artifact = addTrackedRemoteArtifact(manager);
+
+ assertTrue(Files.exists(trackingFileFor(manager, artifact,
"_legacy.txt")));
+ assertFalse(Files.exists(
+ trackingFileFor(manager, artifact,
EnhancedLocalRepositoryManagerFactory.DEFAULT_TRACKING_FILENAME)));
+ }
+
+ @Test
+ void currentKeyWinsOverLegacyKey() throws Exception {
+
session.setConfigProperty(EnhancedLocalRepositoryManagerFactory.CONFIG_PROP_TRACKING_FILENAME,
"_current.txt");
+
session.setConfigProperty("aether.enhancedLocalRepository.trackingFilename",
"_legacy.txt");
+ LocalRepositoryManager manager = newManager();
+ Artifact artifact = addTrackedRemoteArtifact(manager);
+
+ assertTrue(Files.exists(trackingFileFor(manager, artifact,
"_current.txt")));
+ assertFalse(Files.exists(trackingFileFor(manager, artifact,
"_legacy.txt")));
+ }
+
@Test
void newInstanceForNotYetExistingBasedir() throws Exception {
// a fresh local repository (first build on a machine, or a new
-Dmaven.repo.local) does not exist yet