From a47c112663f8366357706fcb8fab0edc5b9c5f55 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Wed, 20 Dec 2023 10:47:16 +0100 Subject: [PATCH] Restoring the option to ignore p2 mirrors via the Maven settings Commit 7e6d5953f34af4e2f6dc3ad45aab7c995a1fbc96 has removed the option to use the settings.xml to disable the usage of p2 mirrors. See https://github.com/eclipse-tycho/tycho/wiki/Frequently-asked-questions#how-do-i-disable-p2-mirrors Restores this option and give the command line option priority. --- .../RemoteArtifactRepositoryManagerAgentFactory.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/RemoteArtifactRepositoryManagerAgentFactory.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/RemoteArtifactRepositoryManagerAgentFactory.java index c936a1669c..0a365f4971 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/RemoteArtifactRepositoryManagerAgentFactory.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/RemoteArtifactRepositoryManagerAgentFactory.java @@ -20,6 +20,7 @@ import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; import org.eclipse.tycho.IRepositoryIdManager; +import org.eclipse.tycho.core.shared.MavenContext; @Component(role = IAgentServiceFactory.class, hint = "org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager") public class RemoteArtifactRepositoryManagerAgentFactory implements IAgentServiceFactory { @@ -33,6 +34,9 @@ public class RemoteArtifactRepositoryManagerAgentFactory implements IAgentServic @Requirement MavenAuthenticator authenticator; + @Requirement + MavenContext mavenContext; + @Override public Object createService(IProvisioningAgent agent) { IArtifactRepositoryManager plainRepoManager = (IArtifactRepositoryManager) new ArtifactRepositoryComponent() @@ -48,6 +52,10 @@ private boolean getDisableP2MirrorsConfiguration() { String key = "tycho.disableP2Mirrors"; String value = System.getProperty(key); + if (value == null) { + value = mavenContext.getSessionProperties().getProperty(key); + } + boolean disableP2Mirrors = Boolean.parseBoolean(value); if (disableP2Mirrors && logger.isDebugEnabled()) { String message = key + "=" + value + " -> ignoring mirrors specified in p2 artifact repositories";