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.git


The following commit(s) were added to refs/heads/master by this push:
     new afc1a2bd8 [MNG-7713] Drop legacy-local-repository option (#1020)
afc1a2bd8 is described below

commit afc1a2bd86e50abc9134c95cb8a762910cf64c3c
Author: Tamas Cservenak <[email protected]>
AuthorDate: Wed Mar 1 11:17:55 2023 +0100

    [MNG-7713] Drop legacy-local-repository option (#1020)
    
    There is really no need for it, and there is a resolver option if really 
must (but really should not, local repo is and should be considered as 
transient).
    
    ---
    
    https://issues.apache.org/jira/browse/MNG-7713
---
 .../execution/DefaultMavenExecutionRequest.java    |  2 +-
 .../maven/execution/MavenExecutionRequest.java     | 10 +++++
 .../DefaultRepositorySystemSessionFactory.java     | 45 +++++++---------------
 .../main/java/org/apache/maven/cli/CLIManager.java |  7 ----
 .../main/java/org/apache/maven/cli/MavenCli.java   |  8 ----
 5 files changed, 25 insertions(+), 47 deletions(-)

diff --git 
a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
 
b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
index cc5a45727..e0a073b91 100644
--- 
a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
+++ 
b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
@@ -1022,7 +1022,7 @@ public class DefaultMavenExecutionRequest implements 
MavenExecutionRequest {
 
     @Override
     public MavenExecutionRequest setUseLegacyLocalRepository(boolean 
useLegacyLocalRepositoryManager) {
-        this.useLegacyLocalRepositoryManager = useLegacyLocalRepositoryManager;
+        this.useLegacyLocalRepositoryManager = false;
         return this;
     }
 
diff --git 
a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
 
b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
index e4a768aa1..9d86df5e8 100644
--- 
a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
+++ 
b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
@@ -443,12 +443,22 @@ public interface MavenExecutionRequest {
 
     /**
      * @since 3.1
+     * @deprecated Since 3.9 there is no direct Maven2 interop offered at LRM 
level. See
+     * <a href="https://maven.apache.org/resolver/configuration.html";>Resolver 
Configuration</a> page option
+     * {@code aether.artifactResolver.simpleLrmInterop} that provides similar 
semantics. This method should
+     * be never invoked, and always returns {@code false}.
      */
+    @Deprecated
     boolean isUseLegacyLocalRepository();
 
     /**
      * @since 3.1
+     * @deprecated Since 3.9 there is no direct Maven2 interop offered at LRM 
level. See
+     * <a href="https://maven.apache.org/resolver/configuration.html";>Resolver 
Configuration</a> page option
+     * {@code aether.artifactResolver.simpleLrmInterop} that provides similar 
semantics. This method should
+     * be never invoked, and ignores parameter (value remains always {@code 
false}).
      */
+    @Deprecated
     MavenExecutionRequest setUseLegacyLocalRepository(boolean 
useLegacyLocalRepository);
 
     /**
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java
 
b/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java
index 1f03faf11..d2ed147e9 100644
--- 
a/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java
+++ 
b/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java
@@ -54,11 +54,9 @@ import org.eclipse.aether.DefaultRepositorySystemSession;
 import org.eclipse.aether.RepositorySystem;
 import org.eclipse.aether.repository.LocalRepository;
 import org.eclipse.aether.repository.LocalRepositoryManager;
-import org.eclipse.aether.repository.NoLocalRepositoryManagerException;
 import org.eclipse.aether.repository.RepositoryPolicy;
 import org.eclipse.aether.repository.WorkspaceReader;
 import org.eclipse.aether.resolution.ResolutionErrorPolicy;
-import org.eclipse.aether.spi.localrepo.LocalRepositoryManagerFactory;
 import org.eclipse.aether.util.ConfigUtils;
 import org.eclipse.aether.util.listener.ChainedRepositoryListener;
 import org.eclipse.aether.util.repository.AuthenticationBuilder;
@@ -129,8 +127,6 @@ public class DefaultRepositorySystemSessionFactory {
 
     private final RepositorySystem repoSystem;
 
-    private final LocalRepositoryManagerFactory simpleLocalRepoMgrFactory;
-
     private final WorkspaceReader workspaceRepository;
 
     private final SettingsDecrypter settingsDecrypter;
@@ -146,7 +142,6 @@ public class DefaultRepositorySystemSessionFactory {
     public DefaultRepositorySystemSessionFactory(
             ArtifactHandlerManager artifactHandlerManager,
             RepositorySystem repoSystem,
-            @Nullable @Named("simple") LocalRepositoryManagerFactory 
simpleLocalRepoMgrFactory,
             @Nullable @Named("ide") WorkspaceReader workspaceRepository,
             SettingsDecrypter settingsDecrypter,
             EventSpyDispatcher eventSpyDispatcher,
@@ -154,7 +149,6 @@ public class DefaultRepositorySystemSessionFactory {
             RuntimeInformation runtimeInformation) {
         this.artifactHandlerManager = artifactHandlerManager;
         this.repoSystem = repoSystem;
-        this.simpleLocalRepoMgrFactory = simpleLocalRepoMgrFactory;
         this.workspaceRepository = workspaceRepository;
         this.settingsDecrypter = settingsDecrypter;
         this.eventSpyDispatcher = eventSpyDispatcher;
@@ -372,33 +366,22 @@ public class DefaultRepositorySystemSessionFactory {
         LocalRepository localRepo =
                 new LocalRepository(request.getLocalRepository().getBasedir());
 
-        if (request.isUseLegacyLocalRepository()) {
-            try {
-                
session.setLocalRepositoryManager(simpleLocalRepoMgrFactory.newInstance(session,
 localRepo));
-                logger.info("Disabling enhanced local repository: using legacy 
is strongly discouraged to ensure"
-                        + " build reproducibility.");
-            } catch (NoLocalRepositoryManagerException e) {
-                logger.error("Failed to configure legacy local repository: 
falling back to default");
-                
session.setLocalRepositoryManager(repoSystem.newLocalRepositoryManager(session, 
localRepo));
+        LocalRepositoryManager lrm = 
repoSystem.newLocalRepositoryManager(session, localRepo);
+
+        String localRepoTail = ConfigUtils.getString(session, null, 
MAVEN_REPO_LOCAL_TAIL);
+        if (localRepoTail != null) {
+            boolean ignoreTailAvailability =
+                    ConfigUtils.getBoolean(session, true, 
MAVEN_REPO_LOCAL_TAIL_IGNORE_AVAILABILITY);
+            List<LocalRepositoryManager> tail = new ArrayList<>();
+            List<String> paths = Arrays.stream(localRepoTail.split(","))
+                    .filter(p -> p != null && !p.trim().isEmpty())
+                    .collect(toList());
+            for (String path : paths) {
+                tail.add(repoSystem.newLocalRepositoryManager(session, new 
LocalRepository(path)));
             }
+            session.setLocalRepositoryManager(new 
ChainedLocalRepositoryManager(lrm, tail, ignoreTailAvailability));
         } else {
-            LocalRepositoryManager lrm = 
repoSystem.newLocalRepositoryManager(session, localRepo);
-
-            String localRepoTail = ConfigUtils.getString(session, null, 
MAVEN_REPO_LOCAL_TAIL);
-            if (localRepoTail != null) {
-                boolean ignoreTailAvailability =
-                        ConfigUtils.getBoolean(session, true, 
MAVEN_REPO_LOCAL_TAIL_IGNORE_AVAILABILITY);
-                List<LocalRepositoryManager> tail = new ArrayList<>();
-                List<String> paths = Arrays.stream(localRepoTail.split(","))
-                        .filter(p -> p != null && !p.trim().isEmpty())
-                        .collect(toList());
-                for (String path : paths) {
-                    tail.add(repoSystem.newLocalRepositoryManager(session, new 
LocalRepository(path)));
-                }
-                session.setLocalRepositoryManager(new 
ChainedLocalRepositoryManager(lrm, tail, ignoreTailAvailability));
-            } else {
-                session.setLocalRepositoryManager(lrm);
-            }
+            session.setLocalRepositoryManager(lrm);
         }
     }
 
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java 
b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
index 60ae83443..5e82a79e9 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
@@ -106,8 +106,6 @@ public class CLIManager {
 
     public static final String THREADS = "T";
 
-    public static final String LEGACY_LOCAL_REPOSITORY = "llr";
-
     public static final String BUILDER = "b";
 
     public static final String NO_TRANSFER_PROGRESS = "ntp";
@@ -276,11 +274,6 @@ public class CLIManager {
                 .hasArg()
                 .desc("Thread count, for instance 4 (int) or 2C/2.5C 
(int/float) where C is core multiplied")
                 .build());
-        options.addOption(Option.builder(LEGACY_LOCAL_REPOSITORY)
-                .longOpt("legacy-local-repository")
-                .desc(
-                        "Use Maven 2 Legacy Local Repository behaviour, ie no 
use of _remote.repositories. Can also be activated by using 
-Dmaven.legacyLocalRepo=true")
-                .build());
         options.addOption(Option.builder(BUILDER)
                 .longOpt("builder")
                 .hasArg()
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java 
b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index df491025a..4f3acf4bf 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -281,7 +281,6 @@ public class MavenCli {
             toolchains(cliRequest);
             populateRequest(cliRequest);
             encryption(cliRequest);
-            repository(cliRequest);
             return execute(cliRequest);
         } catch (ExitException e) {
             return e.exitCode;
@@ -843,13 +842,6 @@ public class MavenCli {
         }
     }
 
-    private void repository(CliRequest cliRequest) throws Exception {
-        if 
(cliRequest.commandLine.hasOption(CLIManager.LEGACY_LOCAL_REPOSITORY)
-                || Boolean.getBoolean("maven.legacyLocalRepo")) {
-            cliRequest.request.setUseLegacyLocalRepository(true);
-        }
-    }
-
     private int execute(CliRequest cliRequest) throws 
MavenExecutionRequestPopulationException {
         MavenExecutionRequest request = 
executionRequestPopulator.populateDefaults(cliRequest.request);
 

Reply via email to