From 7e7357d02f008f8a1b48c9d28ea6073139d1b7f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Wed, 11 Sep 2024 10:03:08 +0200 Subject: [PATCH] Disable injection of target extra repositories --- .../core/maven/MavenDependencyInjector.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/MavenDependencyInjector.java b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/MavenDependencyInjector.java index 5702c70353..06f654197e 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/MavenDependencyInjector.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/MavenDependencyInjector.java @@ -41,9 +41,9 @@ import org.apache.maven.model.Dependency; import org.apache.maven.model.Model; import org.apache.maven.project.MavenProject; -import org.apache.maven.repository.RepositorySystem; import org.apache.maven.settings.Settings; import org.codehaus.plexus.logging.Logger; +import org.eclipse.aether.RepositorySystem; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.tycho.ArtifactDescriptor; import org.eclipse.tycho.ArtifactKey; @@ -155,6 +155,7 @@ public static void injectMavenDependencies(MavenProject project, DependencyArtif .flatMap(definition -> definition.getLocations().stream()).filter(MavenGAVLocation.class::isInstance) .map(MavenGAVLocation.class::cast).flatMap(location -> location.getRepositoryReferences().stream()) .toList(); + //FIXME this should be injected in the model building phase so maven can figure it out directly! if (repositoryReferences != null && !repositoryReferences.isEmpty()) { Map repositoryMap = project.getRemoteArtifactRepositories().stream() .collect(Collectors.toMap(MavenDependencyInjector::getId, Function.identity(), (a, b) -> a, @@ -163,19 +164,19 @@ public static void injectMavenDependencies(MavenProject project, DependencyArtif String id = getId(reference); ArtifactRepository artifactRepository = repositoryMap.get(id); if (artifactRepository == null) { - repositoryMap.put(id, - repositorySystem.createArtifactRepository(id, reference.getUrl(), null, null, null)); +// repositoryMap.put(id, +// repositorySystem.createArtifactRepository(id, reference.getUrl(), null, null, null)); } else if (!artifactRepository.getUrl().equals(reference.getUrl())) { logger.warn("Target defines an artifact repository with the ID " + id + " but there is already a repository for that ID mapped to a different URL! (target URL = " + reference.getUrl() + ", existing URL = " + artifactRepository.getUrl()); } } - List artifactRepositories = new ArrayList<>(repositoryMap.values()); - repositorySystem.injectMirror(artifactRepositories, settings.getMirrors()); - repositorySystem.injectProxy(artifactRepositories, settings.getProxies()); - repositorySystem.injectAuthentication(artifactRepositories, settings.getServers()); - project.setRemoteArtifactRepositories(artifactRepositories); +// List artifactRepositories = new ArrayList<>(repositoryMap.values()); +// repositorySystem.injectMirror(artifactRepositories, settings.getMirrors()); +// repositorySystem.injectProxy(artifactRepositories, settings.getProxies()); +// repositorySystem.injectAuthentication(artifactRepositories, settings.getServers()); +// project.setRemoteArtifactRepositories(artifactRepositories); } }