mirror of https://github.com/apache/maven.git
[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
This commit is contained in:
parent
4e098a3205
commit
afc1a2bd86
|
@ -1022,7 +1022,7 @@ public class DefaultMavenExecutionRequest implements MavenExecutionRequest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MavenExecutionRequest setUseLegacyLocalRepository(boolean useLegacyLocalRepositoryManager) {
|
public MavenExecutionRequest setUseLegacyLocalRepository(boolean useLegacyLocalRepositoryManager) {
|
||||||
this.useLegacyLocalRepositoryManager = useLegacyLocalRepositoryManager;
|
this.useLegacyLocalRepositoryManager = false;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -443,12 +443,22 @@ public interface MavenExecutionRequest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 3.1
|
* @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();
|
boolean isUseLegacyLocalRepository();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 3.1
|
* @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);
|
MavenExecutionRequest setUseLegacyLocalRepository(boolean useLegacyLocalRepository);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,11 +54,9 @@ import org.eclipse.aether.DefaultRepositorySystemSession;
|
||||||
import org.eclipse.aether.RepositorySystem;
|
import org.eclipse.aether.RepositorySystem;
|
||||||
import org.eclipse.aether.repository.LocalRepository;
|
import org.eclipse.aether.repository.LocalRepository;
|
||||||
import org.eclipse.aether.repository.LocalRepositoryManager;
|
import org.eclipse.aether.repository.LocalRepositoryManager;
|
||||||
import org.eclipse.aether.repository.NoLocalRepositoryManagerException;
|
|
||||||
import org.eclipse.aether.repository.RepositoryPolicy;
|
import org.eclipse.aether.repository.RepositoryPolicy;
|
||||||
import org.eclipse.aether.repository.WorkspaceReader;
|
import org.eclipse.aether.repository.WorkspaceReader;
|
||||||
import org.eclipse.aether.resolution.ResolutionErrorPolicy;
|
import org.eclipse.aether.resolution.ResolutionErrorPolicy;
|
||||||
import org.eclipse.aether.spi.localrepo.LocalRepositoryManagerFactory;
|
|
||||||
import org.eclipse.aether.util.ConfigUtils;
|
import org.eclipse.aether.util.ConfigUtils;
|
||||||
import org.eclipse.aether.util.listener.ChainedRepositoryListener;
|
import org.eclipse.aether.util.listener.ChainedRepositoryListener;
|
||||||
import org.eclipse.aether.util.repository.AuthenticationBuilder;
|
import org.eclipse.aether.util.repository.AuthenticationBuilder;
|
||||||
|
@ -129,8 +127,6 @@ public class DefaultRepositorySystemSessionFactory {
|
||||||
|
|
||||||
private final RepositorySystem repoSystem;
|
private final RepositorySystem repoSystem;
|
||||||
|
|
||||||
private final LocalRepositoryManagerFactory simpleLocalRepoMgrFactory;
|
|
||||||
|
|
||||||
private final WorkspaceReader workspaceRepository;
|
private final WorkspaceReader workspaceRepository;
|
||||||
|
|
||||||
private final SettingsDecrypter settingsDecrypter;
|
private final SettingsDecrypter settingsDecrypter;
|
||||||
|
@ -146,7 +142,6 @@ public class DefaultRepositorySystemSessionFactory {
|
||||||
public DefaultRepositorySystemSessionFactory(
|
public DefaultRepositorySystemSessionFactory(
|
||||||
ArtifactHandlerManager artifactHandlerManager,
|
ArtifactHandlerManager artifactHandlerManager,
|
||||||
RepositorySystem repoSystem,
|
RepositorySystem repoSystem,
|
||||||
@Nullable @Named("simple") LocalRepositoryManagerFactory simpleLocalRepoMgrFactory,
|
|
||||||
@Nullable @Named("ide") WorkspaceReader workspaceRepository,
|
@Nullable @Named("ide") WorkspaceReader workspaceRepository,
|
||||||
SettingsDecrypter settingsDecrypter,
|
SettingsDecrypter settingsDecrypter,
|
||||||
EventSpyDispatcher eventSpyDispatcher,
|
EventSpyDispatcher eventSpyDispatcher,
|
||||||
|
@ -154,7 +149,6 @@ public class DefaultRepositorySystemSessionFactory {
|
||||||
RuntimeInformation runtimeInformation) {
|
RuntimeInformation runtimeInformation) {
|
||||||
this.artifactHandlerManager = artifactHandlerManager;
|
this.artifactHandlerManager = artifactHandlerManager;
|
||||||
this.repoSystem = repoSystem;
|
this.repoSystem = repoSystem;
|
||||||
this.simpleLocalRepoMgrFactory = simpleLocalRepoMgrFactory;
|
|
||||||
this.workspaceRepository = workspaceRepository;
|
this.workspaceRepository = workspaceRepository;
|
||||||
this.settingsDecrypter = settingsDecrypter;
|
this.settingsDecrypter = settingsDecrypter;
|
||||||
this.eventSpyDispatcher = eventSpyDispatcher;
|
this.eventSpyDispatcher = eventSpyDispatcher;
|
||||||
|
@ -372,33 +366,22 @@ public class DefaultRepositorySystemSessionFactory {
|
||||||
LocalRepository localRepo =
|
LocalRepository localRepo =
|
||||||
new LocalRepository(request.getLocalRepository().getBasedir());
|
new LocalRepository(request.getLocalRepository().getBasedir());
|
||||||
|
|
||||||
if (request.isUseLegacyLocalRepository()) {
|
LocalRepositoryManager lrm = repoSystem.newLocalRepositoryManager(session, localRepo);
|
||||||
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));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LocalRepositoryManager lrm = repoSystem.newLocalRepositoryManager(session, localRepo);
|
|
||||||
|
|
||||||
String localRepoTail = ConfigUtils.getString(session, null, MAVEN_REPO_LOCAL_TAIL);
|
String localRepoTail = ConfigUtils.getString(session, null, MAVEN_REPO_LOCAL_TAIL);
|
||||||
if (localRepoTail != null) {
|
if (localRepoTail != null) {
|
||||||
boolean ignoreTailAvailability =
|
boolean ignoreTailAvailability =
|
||||||
ConfigUtils.getBoolean(session, true, MAVEN_REPO_LOCAL_TAIL_IGNORE_AVAILABILITY);
|
ConfigUtils.getBoolean(session, true, MAVEN_REPO_LOCAL_TAIL_IGNORE_AVAILABILITY);
|
||||||
List<LocalRepositoryManager> tail = new ArrayList<>();
|
List<LocalRepositoryManager> tail = new ArrayList<>();
|
||||||
List<String> paths = Arrays.stream(localRepoTail.split(","))
|
List<String> paths = Arrays.stream(localRepoTail.split(","))
|
||||||
.filter(p -> p != null && !p.trim().isEmpty())
|
.filter(p -> p != null && !p.trim().isEmpty())
|
||||||
.collect(toList());
|
.collect(toList());
|
||||||
for (String path : paths) {
|
for (String path : paths) {
|
||||||
tail.add(repoSystem.newLocalRepositoryManager(session, new LocalRepository(path)));
|
tail.add(repoSystem.newLocalRepositoryManager(session, new LocalRepository(path)));
|
||||||
}
|
|
||||||
session.setLocalRepositoryManager(new ChainedLocalRepositoryManager(lrm, tail, ignoreTailAvailability));
|
|
||||||
} else {
|
|
||||||
session.setLocalRepositoryManager(lrm);
|
|
||||||
}
|
}
|
||||||
|
session.setLocalRepositoryManager(new ChainedLocalRepositoryManager(lrm, tail, ignoreTailAvailability));
|
||||||
|
} else {
|
||||||
|
session.setLocalRepositoryManager(lrm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,8 +106,6 @@ public class CLIManager {
|
||||||
|
|
||||||
public static final String THREADS = "T";
|
public static final String THREADS = "T";
|
||||||
|
|
||||||
public static final String LEGACY_LOCAL_REPOSITORY = "llr";
|
|
||||||
|
|
||||||
public static final String BUILDER = "b";
|
public static final String BUILDER = "b";
|
||||||
|
|
||||||
public static final String NO_TRANSFER_PROGRESS = "ntp";
|
public static final String NO_TRANSFER_PROGRESS = "ntp";
|
||||||
|
@ -276,11 +274,6 @@ public class CLIManager {
|
||||||
.hasArg()
|
.hasArg()
|
||||||
.desc("Thread count, for instance 4 (int) or 2C/2.5C (int/float) where C is core multiplied")
|
.desc("Thread count, for instance 4 (int) or 2C/2.5C (int/float) where C is core multiplied")
|
||||||
.build());
|
.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)
|
options.addOption(Option.builder(BUILDER)
|
||||||
.longOpt("builder")
|
.longOpt("builder")
|
||||||
.hasArg()
|
.hasArg()
|
||||||
|
|
|
@ -281,7 +281,6 @@ public class MavenCli {
|
||||||
toolchains(cliRequest);
|
toolchains(cliRequest);
|
||||||
populateRequest(cliRequest);
|
populateRequest(cliRequest);
|
||||||
encryption(cliRequest);
|
encryption(cliRequest);
|
||||||
repository(cliRequest);
|
|
||||||
return execute(cliRequest);
|
return execute(cliRequest);
|
||||||
} catch (ExitException e) {
|
} catch (ExitException e) {
|
||||||
return e.exitCode;
|
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 {
|
private int execute(CliRequest cliRequest) throws MavenExecutionRequestPopulationException {
|
||||||
MavenExecutionRequest request = executionRequestPopulator.populateDefaults(cliRequest.request);
|
MavenExecutionRequest request = executionRequestPopulator.populateDefaults(cliRequest.request);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue