From ed153578ca6b5e0e8d12fd8b9b5c14d17bc58165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Mon, 9 Sep 2024 12:17:49 +0200 Subject: [PATCH] Do not use RepositorySystem constant but own Tycho one --- .../tycho/p2maven/transport/DefaultTransportCacheConfig.java | 4 ++-- .../TychoRepositoryTransportCacheManagerAgentFactory.java | 4 ++-- .../src/main/java/org/eclipse/tycho/TychoConstants.java | 5 +++++ .../tycho/osgi/configuration/DefaultMavenContext.java | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/DefaultTransportCacheConfig.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/DefaultTransportCacheConfig.java index 256fe867b6..3cabd8fffe 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/DefaultTransportCacheConfig.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/DefaultTransportCacheConfig.java @@ -16,12 +16,12 @@ import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.repository.RepositorySystem; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; import org.eclipse.aether.transfer.TransferListener; +import org.eclipse.tycho.TychoConstants; @Component(role = TransportCacheConfig.class) public class DefaultTransportCacheConfig implements TransportCacheConfig, Initializable { @@ -39,7 +39,7 @@ public void initialize() throws InitializationException { File repoDir; MavenSession session = legacySupport.getSession(); if (session == null) { - repoDir = RepositorySystem.defaultUserLocalRepository; + repoDir = TychoConstants.DEFAULT_USER_LOCALREPOSITORY; offline = false; update = false; interactive = false; diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/TychoRepositoryTransportCacheManagerAgentFactory.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/TychoRepositoryTransportCacheManagerAgentFactory.java index d78b2c4ac5..fb913cb06c 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/TychoRepositoryTransportCacheManagerAgentFactory.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/TychoRepositoryTransportCacheManagerAgentFactory.java @@ -16,7 +16,6 @@ import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.repository.RepositorySystem; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; @@ -25,6 +24,7 @@ import org.eclipse.equinox.internal.p2.repository.Transport; import org.eclipse.equinox.p2.core.IProvisioningAgent; import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory; +import org.eclipse.tycho.TychoConstants; @Component(role = IAgentServiceFactory.class, hint = "org.eclipse.equinox.internal.p2.repository.CacheManager") public class TychoRepositoryTransportCacheManagerAgentFactory implements IAgentServiceFactory, Initializable { @@ -46,7 +46,7 @@ public Object createService(IProvisioningAgent agent) { public void initialize() throws InitializationException { MavenSession session = legacySupport.getSession(); if (session == null) { - repoDir = RepositorySystem.defaultUserLocalRepository; + repoDir = TychoConstants.DEFAULT_USER_LOCALREPOSITORY; } else { repoDir = new File(session.getLocalRepository().getBasedir()); } diff --git a/tycho-api/src/main/java/org/eclipse/tycho/TychoConstants.java b/tycho-api/src/main/java/org/eclipse/tycho/TychoConstants.java index e734b9871c..e5f1f6604f 100644 --- a/tycho-api/src/main/java/org/eclipse/tycho/TychoConstants.java +++ b/tycho-api/src/main/java/org/eclipse/tycho/TychoConstants.java @@ -14,10 +14,15 @@ *******************************************************************************/ package org.eclipse.tycho; +import java.io.File; import java.util.regex.Pattern; public interface TychoConstants { + String USER_HOME = System.getProperty("user.home"); + File USER_MAVEN_CONFIGURATION_HOME = new File(USER_HOME, ".m2"); + File DEFAULT_USER_LOCALREPOSITORY = new File(USER_MAVEN_CONFIGURATION_HOME, "repository"); + public static final String ECLIPSE_LATEST = "https://download.eclipse.org/releases/2024-06/"; public static final String TYCHO_NOT_CONFIGURED = "Tycho build extension not configured for "; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/DefaultMavenContext.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/DefaultMavenContext.java index 33b0462ca0..fe82715aac 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/DefaultMavenContext.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/DefaultMavenContext.java @@ -31,11 +31,11 @@ import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.LegacySupport; import org.apache.maven.project.MavenProject; -import org.apache.maven.repository.RepositorySystem; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.eclipse.tycho.MavenRepositoryLocation; import org.eclipse.tycho.ReactorProject; +import org.eclipse.tycho.TychoConstants; import org.eclipse.tycho.core.osgitools.DefaultReactorProject; import org.eclipse.tycho.core.shared.MavenContext; import org.eclipse.tycho.core.shared.MavenLogger; @@ -114,7 +114,7 @@ public ChecksumPolicy getChecksumsMode() { public File getLocalRepositoryRoot() { if (repoDir == null) { repoDir = getSession().map(s -> s.getLocalRepository().getBasedir()).map(File::new) - .orElse(RepositorySystem.defaultUserLocalRepository); + .orElse(TychoConstants.DEFAULT_USER_LOCALREPOSITORY); } return repoDir; }