427d469347
This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/tycho.git#3a6b64e698aca93760e544bc3739e4b0d934dcd9
688 lines
41 KiB
Diff
688 lines
41 KiB
Diff
From 9bba214b359e384b3c23b1d31541eda067a62ed3 Mon Sep 17 00:00:00 2001
|
|
From: Roland Grunberg <rgrunber@redhat.com>
|
|
Date: Wed, 18 Jun 2014 13:01:31 -0400
|
|
Subject: [PATCH 3/7] Tycho should always delegate artifact resolution to
|
|
Maven.
|
|
|
|
Maven resolves dependencies from the following locations in the
|
|
following order:
|
|
* reactor,
|
|
* workspace (eg. XMvn),
|
|
* local repository,
|
|
* remote repositories.
|
|
|
|
Tycho assumes that all resolved artifacts are present within the reactor
|
|
cache but this is not true for artifacts resolved from workspace
|
|
locations.
|
|
|
|
Change-Id: Ia44969ed1064965a82c3507a63e54caeebb75b18
|
|
---
|
|
.../tycho/core/shared/MavenContext.java | 1 +
|
|
.../tycho/core/shared/MavenContextImpl.java | 9 +++-
|
|
.../core/shared/MavenRepositorySystem.java | 19 +++++++
|
|
.../LocalArtifactRepositoryP2APITest.java | 4 +-
|
|
.../local/LocalMetadataRepositoryTest.java | 3 +-
|
|
.../local/LocalArtifactRepository.java | 8 +--
|
|
.../local/LocalArtifactRepositoryFactory.java | 3 +-
|
|
.../index/LocalRepositoryP2IndicesImpl.java | 6 +++
|
|
.../remote/RemoteAgentMavenMirrorsTest.java | 3 +-
|
|
...emoteAgentMetadataRepositoryCacheTest.java | 9 ++--
|
|
.../TargetPlatformBundlePublisherTest.java | 4 +-
|
|
.../tycho/p2/target/TestResolverFactory.java | 7 ++-
|
|
.../p2/resolver/P2ResolverFactoryImpl.java | 8 +--
|
|
.../p2/target/PomDependencyCollectorImpl.java | 2 +-
|
|
.../target/TargetPlatformBundlePublisher.java | 6 ++-
|
|
.../MavenBundlesArtifactRepository.java | 7 ++-
|
|
.../repository/LocalRepositoryP2Indices.java | 3 ++
|
|
.../p2/repository/LocalRepositoryReader.java | 50 +++++--------------
|
|
.../TemporaryLocalMavenRepository.java | 4 +-
|
|
.../test/util/MavenRepositorySystemStub.java | 30 +++++++++++
|
|
.../MavenRepositorySystemAdapter.java | 37 ++++++++++++++
|
|
.../MavenContextConfigurator.java | 7 ++-
|
|
22 files changed, 166 insertions(+), 64 deletions(-)
|
|
create mode 100644 tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenRepositorySystem.java
|
|
create mode 100644 tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/MavenRepositorySystemStub.java
|
|
create mode 100644 tycho-core/src/main/java/org/eclipse/tycho/osgi/adapters/MavenRepositorySystemAdapter.java
|
|
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContext.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContext.java
|
|
index 3836f70..b87d1f3 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContext.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContext.java
|
|
@@ -50,4 +50,5 @@ public interface MavenContext {
|
|
*/
|
|
public Collection<ReactorProject> getProjects();
|
|
|
|
+ public MavenRepositorySystem getRepositorySystem();
|
|
}
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContextImpl.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContextImpl.java
|
|
index 4a85819..fd831a1 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContextImpl.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContextImpl.java
|
|
@@ -29,18 +29,20 @@ public class MavenContextImpl implements MavenContext {
|
|
private boolean offline;
|
|
private Properties mergedProperties;
|
|
private List<ReactorProject> projects = new ArrayList<>();
|
|
+ private MavenRepositorySystem repositorySystem;
|
|
|
|
public MavenContextImpl(File localRepositoryRoot, boolean offline, MavenLogger mavenLogger,
|
|
- Properties mergedProperties) {
|
|
+ Properties mergedProperties, MavenRepositorySystem repositorySystem) {
|
|
this.localRepositoryRoot = localRepositoryRoot;
|
|
this.offline = offline;
|
|
this.mavenLogger = mavenLogger;
|
|
this.mergedProperties = mergedProperties;
|
|
+ this.repositorySystem = repositorySystem;
|
|
}
|
|
|
|
// constructor for tests
|
|
public MavenContextImpl(File localRepositoryRoot, MavenLogger mavenLogger) {
|
|
- this(localRepositoryRoot, false, mavenLogger, new Properties());
|
|
+ this(localRepositoryRoot, false, mavenLogger, new Properties(), null);
|
|
}
|
|
|
|
@Override
|
|
@@ -72,4 +74,7 @@ public class MavenContextImpl implements MavenContext {
|
|
projects.add(reactorProject);
|
|
}
|
|
|
|
+ public MavenRepositorySystem getRepositorySystem() {
|
|
+ return repositorySystem;
|
|
+ }
|
|
}
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenRepositorySystem.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenRepositorySystem.java
|
|
new file mode 100644
|
|
index 0000000..965e5cd
|
|
--- /dev/null
|
|
+++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenRepositorySystem.java
|
|
@@ -0,0 +1,19 @@
|
|
+/*******************************************************************************
|
|
+ * Copyright (c) 2014 Red Hat Inc.
|
|
+ * All rights reserved. This program and the accompanying materials
|
|
+ * are made available under the terms of the Eclipse Public License v1.0
|
|
+ * which accompanies this distribution, and is available at
|
|
+ * http://www.eclipse.org/legal/epl-v10.html
|
|
+ *
|
|
+ * Contributors:
|
|
+ * Red Hat Inc. - initial API and implementation
|
|
+ *******************************************************************************/
|
|
+package org.eclipse.tycho.core.shared;
|
|
+
|
|
+import java.io.File;
|
|
+
|
|
+public interface MavenRepositorySystem {
|
|
+
|
|
+ public File resolve(String gid, String aid, String version, String type, String classifier);
|
|
+
|
|
+}
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryP2APITest.java b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryP2APITest.java
|
|
index 43eb9af..68c7878 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryP2APITest.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryP2APITest.java
|
|
@@ -55,6 +55,7 @@ import org.eclipse.tycho.repository.p2base.artifact.repository.ArtifactRepositor
|
|
import org.eclipse.tycho.repository.streaming.testutil.ProbeArtifactSink;
|
|
import org.eclipse.tycho.repository.streaming.testutil.ProbeOutputStream;
|
|
import org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink;
|
|
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
|
|
import org.junit.After;
|
|
import org.junit.Assume;
|
|
import org.junit.Before;
|
|
@@ -116,7 +117,8 @@ public class LocalArtifactRepositoryP2APITest {
|
|
@Before
|
|
public void initSubject() throws Exception {
|
|
temporaryLocalMavenRepo.initContentFromResourceFolder(ResourceUtil.resourceFile("repositories/local"));
|
|
- subject = new LocalArtifactRepository(null, temporaryLocalMavenRepo.getLocalRepositoryIndex());
|
|
+ subject = new LocalArtifactRepository(null, temporaryLocalMavenRepo.getLocalRepositoryIndex(),
|
|
+ new MavenRepositorySystemStub(temporaryLocalMavenRepo.getLocalRepositoryRoot()));
|
|
|
|
testOutputStream = new ProbeOutputStream();
|
|
}
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalMetadataRepositoryTest.java b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalMetadataRepositoryTest.java
|
|
index 1c9fba1..b534686 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalMetadataRepositoryTest.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalMetadataRepositoryTest.java
|
|
@@ -35,6 +35,7 @@ import org.eclipse.tycho.p2.repository.LocalRepositoryReader;
|
|
import org.eclipse.tycho.p2.repository.RepositoryLayoutHelper;
|
|
import org.eclipse.tycho.p2.repository.TychoRepositoryIndex;
|
|
import org.eclipse.tycho.repository.local.index.FileBasedTychoRepositoryIndex;
|
|
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
|
|
import org.eclipse.tycho.test.util.NoopFileLockService;
|
|
import org.junit.Assert;
|
|
import org.junit.Test;
|
|
@@ -53,7 +54,7 @@ public class LocalMetadataRepositoryTest {
|
|
|
|
protected IMetadataRepository loadRepository(File location) throws ProvisionException {
|
|
return new LocalMetadataRepository(location.toURI(), createMetadataIndex(location),
|
|
- new LocalRepositoryReader(location));
|
|
+ new LocalRepositoryReader(location, new MavenRepositorySystemStub(location)));
|
|
}
|
|
|
|
private TychoRepositoryIndex createMetadataIndex(File location) {
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepository.java b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepository.java
|
|
index 7a11200..649042b 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepository.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepository.java
|
|
@@ -31,6 +31,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
|
import org.eclipse.equinox.p2.core.IProvisioningAgent;
|
|
import org.eclipse.equinox.p2.metadata.IArtifactKey;
|
|
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
|
|
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
|
|
import org.eclipse.tycho.p2.maven.repository.Activator;
|
|
import org.eclipse.tycho.p2.maven.repository.xmlio.ArtifactsIO;
|
|
import org.eclipse.tycho.p2.repository.GAV;
|
|
@@ -51,15 +52,16 @@ public class LocalArtifactRepository extends ArtifactRepositoryBaseImpl<GAVArtif
|
|
|
|
// TODO what is the agent needed for? does using the default agent harm?
|
|
public LocalArtifactRepository(LocalRepositoryP2Indices localRepoIndices) {
|
|
- this(Activator.getProvisioningAgent(), localRepoIndices);
|
|
+ this(Activator.getProvisioningAgent(), localRepoIndices, (MavenRepositorySystem) null);
|
|
}
|
|
|
|
public LocalArtifactRepository(LocalRepositoryP2Indices localRepoIndices, RepositoryReader contentLocator) {
|
|
this(Activator.getProvisioningAgent(), localRepoIndices, contentLocator);
|
|
}
|
|
|
|
- public LocalArtifactRepository(IProvisioningAgent agent, LocalRepositoryP2Indices localRepoIndices) {
|
|
- this(agent, localRepoIndices, new LocalRepositoryReader(localRepoIndices.getBasedir()));
|
|
+ public LocalArtifactRepository(IProvisioningAgent agent, LocalRepositoryP2Indices localRepoIndices,
|
|
+ MavenRepositorySystem repositorySystem) {
|
|
+ this(agent, localRepoIndices, new LocalRepositoryReader(localRepoIndices.getBasedir(), repositorySystem));
|
|
}
|
|
|
|
public LocalArtifactRepository(IProvisioningAgent agent, LocalRepositoryP2Indices localRepoIndices,
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryFactory.java b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryFactory.java
|
|
index 8d01519..0173a9c 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryFactory.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryFactory.java
|
|
@@ -43,7 +43,8 @@ public class LocalArtifactRepositoryFactory extends ArtifactRepositoryFactory {
|
|
if (localRepositoryDirectory.isDirectory()
|
|
&& new File(localRepositoryDirectory, ".meta/p2-artifacts.properties").exists()) {
|
|
// see FileBasedTychoRepositoryIndex#ARTIFACTS_INDEX_RELPATH
|
|
- return new LocalArtifactRepository(getAgent(), lookupLocalRepoIndices());
|
|
+ return new LocalArtifactRepository(getAgent(), lookupLocalRepoIndices(),
|
|
+ lookupLocalRepoIndices().getRepositorySystem());
|
|
}
|
|
}
|
|
return null;
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/index/LocalRepositoryP2IndicesImpl.java b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/index/LocalRepositoryP2IndicesImpl.java
|
|
index 4cf6511..fc3cc9f 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/index/LocalRepositoryP2IndicesImpl.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/index/LocalRepositoryP2IndicesImpl.java
|
|
@@ -17,6 +17,7 @@ import java.io.File;
|
|
|
|
import org.eclipse.tycho.core.shared.MavenContext;
|
|
import org.eclipse.tycho.core.shared.MavenLogger;
|
|
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
|
|
import org.eclipse.tycho.locking.facade.FileLockService;
|
|
import org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices;
|
|
import org.eclipse.tycho.p2.repository.TychoRepositoryIndex;
|
|
@@ -27,6 +28,7 @@ public class LocalRepositoryP2IndicesImpl implements LocalRepositoryP2Indices {
|
|
private FileLockService fileLockService;
|
|
private File localRepositoryRoot;
|
|
private MavenLogger logger;
|
|
+ private MavenRepositorySystem repoSystem;
|
|
|
|
// derived members
|
|
private boolean initialized = false;
|
|
@@ -41,6 +43,7 @@ public class LocalRepositoryP2IndicesImpl implements LocalRepositoryP2Indices {
|
|
public void setMavenContext(MavenContext mavenContext) {
|
|
this.localRepositoryRoot = mavenContext.getLocalRepositoryRoot();
|
|
this.logger = mavenContext.getLogger();
|
|
+ this.repoSystem = mavenContext.getRepositorySystem();
|
|
}
|
|
|
|
// injected by DS runtime
|
|
@@ -82,4 +85,7 @@ public class LocalRepositoryP2IndicesImpl implements LocalRepositoryP2Indices {
|
|
return localRepositoryRoot;
|
|
}
|
|
|
|
+ public MavenRepositorySystem getRepositorySystem() {
|
|
+ return repoSystem;
|
|
+ }
|
|
}
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMavenMirrorsTest.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMavenMirrorsTest.java
|
|
index d7042fc..2f9dbc8 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMavenMirrorsTest.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMavenMirrorsTest.java
|
|
@@ -31,6 +31,7 @@ import org.eclipse.tycho.p2.impl.test.ResourceUtil;
|
|
import org.eclipse.tycho.p2.remote.testutil.MavenRepositorySettingsStub;
|
|
import org.eclipse.tycho.test.util.HttpServer;
|
|
import org.eclipse.tycho.test.util.LogVerifier;
|
|
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
|
|
import org.junit.Before;
|
|
import org.junit.Rule;
|
|
import org.junit.Test;
|
|
@@ -54,7 +55,7 @@ public class RemoteAgentMavenMirrorsTest {
|
|
public void initSubject() throws Exception {
|
|
File localRepository = tempManager.newFolder("localRepo");
|
|
MavenContext mavenContext = new MavenContextImpl(localRepository, OFFLINE, logVerifier.getLogger(),
|
|
- new Properties());
|
|
+ new Properties(), new MavenRepositorySystemStub(localRepository));
|
|
|
|
mavenRepositorySettings = new MavenRepositorySettingsStub();
|
|
subject = new RemoteAgent(mavenContext, mavenRepositorySettings, OFFLINE);
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMetadataRepositoryCacheTest.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMetadataRepositoryCacheTest.java
|
|
index c3bd41c..802da29 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMetadataRepositoryCacheTest.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMetadataRepositoryCacheTest.java
|
|
@@ -28,6 +28,7 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
|
|
import org.eclipse.tycho.core.shared.MavenContextImpl;
|
|
import org.eclipse.tycho.test.util.HttpServer;
|
|
import org.eclipse.tycho.test.util.LogVerifier;
|
|
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
|
|
import org.junit.Before;
|
|
import org.junit.Rule;
|
|
import org.junit.Test;
|
|
@@ -127,13 +128,13 @@ public class RemoteAgentMetadataRepositoryCacheTest {
|
|
}
|
|
|
|
private RemoteAgent newOnlineAgent() throws Exception {
|
|
- return new RemoteAgent(
|
|
- new MavenContextImpl(localMavenRepository, false, logVerifier.getLogger(), new Properties()));
|
|
+ return new RemoteAgent(new MavenContextImpl(localMavenRepository, false, logVerifier.getLogger(),
|
|
+ new Properties(), new MavenRepositorySystemStub(localMavenRepository)));
|
|
}
|
|
|
|
private RemoteAgent newOfflineAgent() throws Exception {
|
|
- return new RemoteAgent(
|
|
- new MavenContextImpl(localMavenRepository, true, logVerifier.getLogger(), new Properties()));
|
|
+ return new RemoteAgent(new MavenContextImpl(localMavenRepository, true, logVerifier.getLogger(),
|
|
+ new Properties(), new MavenRepositorySystemStub(localMavenRepository)));
|
|
}
|
|
|
|
private IMetadataRepository loadHttpRepository(RemoteAgent agent) throws ProvisionException {
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisherTest.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisherTest.java
|
|
index da8bdf1..176ba81 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisherTest.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisherTest.java
|
|
@@ -42,6 +42,7 @@ import org.eclipse.tycho.p2.resolver.WrappedArtifact;
|
|
import org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactProvider;
|
|
import org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink;
|
|
import org.eclipse.tycho.test.util.LogVerifier;
|
|
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
|
|
import org.junit.Before;
|
|
import org.junit.Rule;
|
|
import org.junit.Test;
|
|
@@ -69,7 +70,8 @@ public class TargetPlatformBundlePublisherTest {
|
|
|
|
localRepositoryRoot = tempFolder.getRoot();
|
|
subject = new TargetPlatformBundlePublisher(localRepositoryRoot,
|
|
- new ReactorProjectStub(tempFolder.newFolder(), "test"), logVerifier.getLogger());
|
|
+ new ReactorProjectStub(tempFolder.newFolder(), "test"), logVerifier.getLogger(),
|
|
+ new MavenRepositorySystemStub(localRepositoryRoot));
|
|
}
|
|
|
|
@Test
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TestResolverFactory.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TestResolverFactory.java
|
|
index 33a98e4..0ea66e2 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TestResolverFactory.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TestResolverFactory.java
|
|
@@ -32,6 +32,7 @@ import org.eclipse.tycho.p2.target.facade.TargetPlatformFactory;
|
|
import org.eclipse.tycho.repository.local.LocalArtifactRepository;
|
|
import org.eclipse.tycho.repository.local.LocalMetadataRepository;
|
|
import org.eclipse.tycho.repository.local.index.LocalRepositoryP2IndicesImpl;
|
|
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
|
|
import org.eclipse.tycho.test.util.NoopFileLockService;
|
|
|
|
public class TestResolverFactory implements P2ResolverFactory {
|
|
@@ -50,7 +51,8 @@ public class TestResolverFactory implements P2ResolverFactory {
|
|
|
|
File localMavenRepoRoot = mavenContext.getLocalRepositoryRoot();
|
|
LocalRepositoryP2Indices localRepoIndices = createLocalRepoIndices(mavenContext);
|
|
- LocalRepositoryReader localRepositoryReader = new LocalRepositoryReader(localMavenRepoRoot);
|
|
+ LocalRepositoryReader localRepositoryReader = new LocalRepositoryReader(localMavenRepoRoot,
|
|
+ mavenContext.getRepositorySystem());
|
|
localMetadataRepo = new LocalMetadataRepository(localMavenRepoRoot.toURI(), localRepoIndices.getMetadataIndex(),
|
|
localRepositoryReader);
|
|
localArtifactRepo = new LocalArtifactRepository(localRepoIndices, localRepositoryReader);
|
|
@@ -61,7 +63,8 @@ public class TestResolverFactory implements P2ResolverFactory {
|
|
}
|
|
|
|
private MavenContext createMavenContext(boolean offline, MavenLogger logger) {
|
|
- return new MavenContextImpl(getLocalRepositoryLocation(), offline, logger, new Properties());
|
|
+ return new MavenContextImpl(getLocalRepositoryLocation(), offline, logger, new Properties(),
|
|
+ new MavenRepositorySystemStub(getLocalRepositoryLocation()));
|
|
}
|
|
|
|
// TODO use TemporaryLocalMavenRepository
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/resolver/P2ResolverFactoryImpl.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/resolver/P2ResolverFactoryImpl.java
|
|
index bb227a4..9481da4 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/resolver/P2ResolverFactoryImpl.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/resolver/P2ResolverFactoryImpl.java
|
|
@@ -37,7 +37,7 @@ public class P2ResolverFactoryImpl implements P2ResolverFactory {
|
|
private static LocalMetadataRepository localMetadataRepository;
|
|
private static LocalArtifactRepository localArtifactRepository;
|
|
|
|
- private MavenContext mavenContext;
|
|
+ private static MavenContext mavenContext;
|
|
private LocalRepositoryP2Indices localRepoIndices;
|
|
private RemoteAgentManager remoteAgentManager;
|
|
private TargetDefinitionResolverService targetDefinitionResolverService;
|
|
@@ -46,7 +46,8 @@ public class P2ResolverFactoryImpl implements P2ResolverFactory {
|
|
LocalRepositoryP2Indices localRepoIndices) {
|
|
if (localMetadataRepository == null) {
|
|
File localMavenRepoRoot = context.getLocalRepositoryRoot();
|
|
- RepositoryReader contentLocator = new LocalRepositoryReader(localMavenRepoRoot);
|
|
+ RepositoryReader contentLocator = new LocalRepositoryReader(localMavenRepoRoot,
|
|
+ mavenContext.getRepositorySystem());
|
|
localMetadataRepository = new LocalMetadataRepository(localMavenRepoRoot.toURI(),
|
|
localRepoIndices.getMetadataIndex(), contentLocator);
|
|
|
|
@@ -57,7 +58,8 @@ public class P2ResolverFactoryImpl implements P2ResolverFactory {
|
|
private static synchronized LocalArtifactRepository getLocalArtifactRepository(MavenContext mavenContext,
|
|
LocalRepositoryP2Indices localRepoIndices) {
|
|
if (localArtifactRepository == null) {
|
|
- RepositoryReader contentLocator = new LocalRepositoryReader(mavenContext.getLocalRepositoryRoot());
|
|
+ RepositoryReader contentLocator = new LocalRepositoryReader(mavenContext.getLocalRepositoryRoot(),
|
|
+ mavenContext.getRepositorySystem());
|
|
localArtifactRepository = new LocalArtifactRepository(localRepoIndices, contentLocator);
|
|
}
|
|
return localArtifactRepository;
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/PomDependencyCollectorImpl.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/PomDependencyCollectorImpl.java
|
|
index 589418e..4ad19f5 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/PomDependencyCollectorImpl.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/PomDependencyCollectorImpl.java
|
|
@@ -49,7 +49,7 @@ public class PomDependencyCollectorImpl implements PomDependencyCollector {
|
|
|
|
File localRepositoryRoot = mavenContext.getLocalRepositoryRoot();
|
|
this.bundlesPublisher = new TargetPlatformBundlePublisher(localRepositoryRoot, project,
|
|
- mavenContext.getLogger());
|
|
+ mavenContext.getLogger(), mavenContext.getRepositorySystem());
|
|
}
|
|
|
|
public File getProjectLocation() {
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisher.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisher.java
|
|
index d7119d7..83ab36e 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisher.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisher.java
|
|
@@ -35,6 +35,7 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
|
|
import org.eclipse.osgi.service.resolver.BundleDescription;
|
|
import org.eclipse.tycho.ReactorProject;
|
|
import org.eclipse.tycho.core.shared.MavenLogger;
|
|
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
|
|
import org.eclipse.tycho.p2.impl.publisher.MavenPropertiesAdvice;
|
|
import org.eclipse.tycho.p2.impl.publisher.repo.TransientArtifactRepository;
|
|
import org.eclipse.tycho.p2.metadata.IArtifactFacade;
|
|
@@ -52,9 +53,10 @@ public class TargetPlatformBundlePublisher {
|
|
private final MavenBundlesArtifactRepository publishedArtifacts;
|
|
private ReactorProject project;
|
|
|
|
- public TargetPlatformBundlePublisher(File localMavenRepositoryRoot, ReactorProject project, MavenLogger logger) {
|
|
+ public TargetPlatformBundlePublisher(File localMavenRepositoryRoot, ReactorProject project, MavenLogger logger,
|
|
+ MavenRepositorySystem repositorySystem) {
|
|
this.project = project;
|
|
- this.publishedArtifacts = new MavenBundlesArtifactRepository(localMavenRepositoryRoot);
|
|
+ this.publishedArtifacts = new MavenBundlesArtifactRepository(localMavenRepositoryRoot, repositorySystem);
|
|
this.logger = logger;
|
|
}
|
|
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/repository/MavenBundlesArtifactRepository.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/repository/MavenBundlesArtifactRepository.java
|
|
index 59aab38..67df39d 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/repository/MavenBundlesArtifactRepository.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/repository/MavenBundlesArtifactRepository.java
|
|
@@ -21,6 +21,7 @@ import java.io.File;
|
|
import org.eclipse.core.runtime.AssertionFailedException;
|
|
import org.eclipse.equinox.p2.metadata.IArtifactKey;
|
|
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
|
|
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
|
|
import org.eclipse.tycho.p2.metadata.IArtifactFacade;
|
|
import org.eclipse.tycho.p2.repository.LocalRepositoryReader;
|
|
import org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates;
|
|
@@ -49,9 +50,11 @@ import org.eclipse.tycho.repository.p2base.artifact.repository.ArtifactRepositor
|
|
* </p>
|
|
*/
|
|
public final class MavenBundlesArtifactRepository extends ArtifactRepositoryBaseImpl<GAVArtifactDescriptor> {
|
|
+ private MavenRepositorySystem repositorySystem;
|
|
|
|
- public MavenBundlesArtifactRepository(File localMavenRepositoryRoot) {
|
|
+ public MavenBundlesArtifactRepository(File localMavenRepositoryRoot, MavenRepositorySystem repositorySystem) {
|
|
super(null, localMavenRepositoryRoot.toURI(), ArtifactTransferPolicies.forLocalArtifacts());
|
|
+ this.repositorySystem = repositorySystem;
|
|
}
|
|
|
|
public void addPublishedArtifact(IArtifactDescriptor baseDescriptor, IArtifactFacade mavenArtifact) {
|
|
@@ -91,7 +94,7 @@ public final class MavenBundlesArtifactRepository extends ArtifactRepositoryBase
|
|
@Override
|
|
protected File internalGetArtifactStorageLocation(IArtifactDescriptor descriptor) {
|
|
MavenRepositoryCoordinates coord = toInternalDescriptor(descriptor).getMavenCoordinates();
|
|
- LocalRepositoryReader reader = new LocalRepositoryReader(getBaseDir());
|
|
+ LocalRepositoryReader reader = new LocalRepositoryReader(getBaseDir(), repositorySystem);
|
|
return reader.getLocalArtifactLocation(coord.getGav(), coord.getClassifier(),
|
|
coord.getExtensionOrDefault());
|
|
}
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryP2Indices.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryP2Indices.java
|
|
index 7a1303b..1a8feb4 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryP2Indices.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryP2Indices.java
|
|
@@ -15,6 +15,8 @@ package org.eclipse.tycho.p2.repository;
|
|
|
|
import java.io.File;
|
|
|
|
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
|
|
+
|
|
/**
|
|
* This service provides access to the tycho p2 index files of the local maven repository.
|
|
*/
|
|
@@ -26,4 +28,5 @@ public interface LocalRepositoryP2Indices {
|
|
|
|
public File getBasedir();
|
|
|
|
+ public MavenRepositorySystem getRepositorySystem();
|
|
}
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java
|
|
index 959a257..3c8fb8b 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java
|
|
@@ -13,57 +13,31 @@
|
|
package org.eclipse.tycho.p2.repository;
|
|
|
|
import java.io.File;
|
|
-import java.lang.reflect.Constructor;
|
|
-import java.lang.reflect.Method;
|
|
+
|
|
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
|
|
|
|
public class LocalRepositoryReader implements RepositoryReader {
|
|
|
|
private final File localMavenRepositoryRoot;
|
|
+ private final MavenRepositorySystem repositorySystem;
|
|
|
|
- public LocalRepositoryReader(File localMavenRepositoryRoot) {
|
|
+ public LocalRepositoryReader(File localMavenRepositoryRoot, MavenRepositorySystem repositorySystem) {
|
|
this.localMavenRepositoryRoot = localMavenRepositoryRoot;
|
|
+ this.repositorySystem = repositorySystem;
|
|
}
|
|
|
|
@Override
|
|
public File getLocalArtifactLocation(GAV gav, String classifier, String extension) {
|
|
- File file = new File(localMavenRepositoryRoot,
|
|
+ File ret = new File(localMavenRepositoryRoot,
|
|
RepositoryLayoutHelper.getRelativePath(gav, classifier, extension));
|
|
- // In Fedora the artifact may be in an XMvn-defined repository location (not in reactor cache)
|
|
- if (!file.exists()) {
|
|
- try {
|
|
- // Create Plexus config
|
|
- Class<?> pcclazz = Class.forName("org.codehaus.plexus.ContainerConfiguration");
|
|
- Object conf = Class.forName("org.codehaus.plexus.DefaultContainerConfiguration").newInstance();
|
|
- pcclazz.getMethod("setAutoWiring", boolean.class).invoke(conf, true);
|
|
- pcclazz.getMethod("setClassPathScanning", String.class).invoke(conf, "index");
|
|
-
|
|
- // Use plexus container to lookup the reader
|
|
- Class<?> pclazz = Class.forName("org.codehaus.plexus.DefaultPlexusContainer");
|
|
- Object plexus = pclazz.getConstructor(pcclazz).newInstance(conf);
|
|
-
|
|
- // Retrieve the workspace reader from the plexus container
|
|
- Method mLookup = pclazz.getMethod("lookup", String.class, String.class);
|
|
- Object reader = mLookup.invoke(plexus, "org.eclipse.aether.repository.WorkspaceReader", "ide");
|
|
-
|
|
- // Create an Aether Artifact based on GAV, classifier, and extension
|
|
- Class<?> iartclazz = Class.forName("org.eclipse.aether.artifact.Artifact");
|
|
- Class<?> artclazz = Class.forName("org.eclipse.aether.artifact.DefaultArtifact");
|
|
- Constructor<?> cNew = artclazz.getConstructor(String.class, String.class, String.class, String.class,
|
|
- String.class);
|
|
- Object artifact = cNew.newInstance(gav.getGroupId(), gav.getArtifactId(), classifier, extension,
|
|
- gav.getVersion());
|
|
-
|
|
- // Invoke "findArtifact" method of the workspace reader on the artifact
|
|
- Method mfindArtifact = reader.getClass().getMethod("findArtifact", iartclazz);
|
|
- File newFile = (File) mfindArtifact.invoke(reader, artifact);
|
|
- if (newFile != null) {
|
|
- file = newFile;
|
|
- }
|
|
- } catch (Exception e) {
|
|
- e.printStackTrace();
|
|
+ if (repositorySystem != null) {
|
|
+ File tmp = repositorySystem.resolve(gav.getGroupId(), gav.getArtifactId(), gav.getVersion(), extension,
|
|
+ classifier);
|
|
+ if (tmp != null) {
|
|
+ ret = tmp;
|
|
}
|
|
}
|
|
- return file;
|
|
+ return ret;
|
|
}
|
|
|
|
}
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/repository/local/testutil/TemporaryLocalMavenRepository.java b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/repository/local/testutil/TemporaryLocalMavenRepository.java
|
|
index fe0c456..8b1a9d1 100644
|
|
--- a/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/repository/local/testutil/TemporaryLocalMavenRepository.java
|
|
+++ b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/repository/local/testutil/TemporaryLocalMavenRepository.java
|
|
@@ -19,6 +19,7 @@ import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
|
|
import org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices;
|
|
import org.eclipse.tycho.repository.local.LocalArtifactRepository;
|
|
import org.eclipse.tycho.repository.local.index.LocalRepositoryP2IndicesImpl;
|
|
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
|
|
import org.eclipse.tycho.test.util.NoopFileLockService;
|
|
import org.junit.Rule;
|
|
import org.junit.rules.ExternalResource;
|
|
@@ -74,7 +75,8 @@ public class TemporaryLocalMavenRepository extends ExternalResource {
|
|
|
|
public LocalArtifactRepository getLocalArtifactRepository() {
|
|
if (repo == null) {
|
|
- repo = new LocalArtifactRepository(null, getLocalRepositoryIndex());
|
|
+ repo = new LocalArtifactRepository(null, getLocalRepositoryIndex(),
|
|
+ new MavenRepositorySystemStub(getLocalRepositoryRoot()));
|
|
}
|
|
return repo;
|
|
}
|
|
diff --git a/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/MavenRepositorySystemStub.java b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/MavenRepositorySystemStub.java
|
|
new file mode 100644
|
|
index 0000000..be02d64
|
|
--- /dev/null
|
|
+++ b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/MavenRepositorySystemStub.java
|
|
@@ -0,0 +1,30 @@
|
|
+/*******************************************************************************
|
|
+ * Copyright (c) 2014 Red Hat Inc.
|
|
+ * All rights reserved. This program and the accompanying materials
|
|
+ * are made available under the terms of the Eclipse Public License v1.0
|
|
+ * which accompanies this distribution, and is available at
|
|
+ * http://www.eclipse.org/legal/epl-v10.html
|
|
+ *
|
|
+ * Contributors:
|
|
+ * Red Hat Inc. - initial API and implementation
|
|
+ *******************************************************************************/
|
|
+package org.eclipse.tycho.test.util;
|
|
+
|
|
+import java.io.File;
|
|
+
|
|
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
|
|
+import org.eclipse.tycho.p2.repository.RepositoryLayoutHelper;
|
|
+
|
|
+public class MavenRepositorySystemStub implements MavenRepositorySystem {
|
|
+
|
|
+ private File localMavenRepositoryRoot;
|
|
+
|
|
+ public MavenRepositorySystemStub(File localMavenRepositoryRoot) {
|
|
+ this.localMavenRepositoryRoot = localMavenRepositoryRoot;
|
|
+ }
|
|
+
|
|
+ public File resolve(String gid, String aid, String version, String type, String classifier) {
|
|
+ return new File(localMavenRepositoryRoot,
|
|
+ RepositoryLayoutHelper.getRelativePath(gid, aid, version, classifier, type));
|
|
+ }
|
|
+}
|
|
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/adapters/MavenRepositorySystemAdapter.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/adapters/MavenRepositorySystemAdapter.java
|
|
new file mode 100644
|
|
index 0000000..e1d46fa
|
|
--- /dev/null
|
|
+++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/adapters/MavenRepositorySystemAdapter.java
|
|
@@ -0,0 +1,37 @@
|
|
+/*******************************************************************************
|
|
+ * Copyright (c) 2014 Red Hat Inc.
|
|
+ * All rights reserved. This program and the accompanying materials
|
|
+ * are made available under the terms of the Eclipse Public License v1.0
|
|
+ * which accompanies this distribution, and is available at
|
|
+ * http://www.eclipse.org/legal/epl-v10.html
|
|
+ *
|
|
+ * Contributors:
|
|
+ * Red Hat Inc. - initial API and implementation
|
|
+ *******************************************************************************/
|
|
+package org.eclipse.tycho.osgi.adapters;
|
|
+
|
|
+import java.io.File;
|
|
+
|
|
+import org.apache.maven.artifact.Artifact;
|
|
+import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
|
|
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
|
+import org.apache.maven.repository.RepositorySystem;
|
|
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
|
|
+
|
|
+public class MavenRepositorySystemAdapter implements MavenRepositorySystem {
|
|
+
|
|
+ private RepositorySystem repoSystem;
|
|
+
|
|
+ public MavenRepositorySystemAdapter(RepositorySystem repoSystem) {
|
|
+ this.repoSystem = repoSystem;
|
|
+ }
|
|
+
|
|
+ public File resolve(String gid, String aid, String version, String type, String classifier) {
|
|
+ ArtifactResolutionRequest req = new ArtifactResolutionRequest();
|
|
+ Artifact art = repoSystem.createArtifactWithClassifier(gid, aid, version, type, classifier);
|
|
+ req.setArtifact(art);
|
|
+ ArtifactResolutionResult res = repoSystem.resolve(req);
|
|
+ return res.getArtifacts().size() > 0 ? res.getArtifacts().toArray(new Artifact[0])[0].getFile() : null;
|
|
+ }
|
|
+
|
|
+}
|
|
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/MavenContextConfigurator.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/MavenContextConfigurator.java
|
|
index 4a21341..e16c7e0 100644
|
|
--- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/MavenContextConfigurator.java
|
|
+++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/MavenContextConfigurator.java
|
|
@@ -18,6 +18,7 @@ import java.util.Properties;
|
|
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.apache.maven.settings.Profile;
|
|
import org.apache.maven.settings.Settings;
|
|
import org.codehaus.plexus.component.annotations.Component;
|
|
@@ -29,6 +30,7 @@ import org.eclipse.tycho.core.osgitools.DefaultReactorProject;
|
|
import org.eclipse.tycho.core.shared.MavenContext;
|
|
import org.eclipse.tycho.core.shared.MavenContextImpl;
|
|
import org.eclipse.tycho.osgi.adapters.MavenLoggerAdapter;
|
|
+import org.eclipse.tycho.osgi.adapters.MavenRepositorySystemAdapter;
|
|
|
|
@Component(role = EquinoxLifecycleListener.class, hint = "MavenContextConfigurator")
|
|
public class MavenContextConfigurator extends EquinoxLifecycleListener {
|
|
@@ -39,6 +41,9 @@ public class MavenContextConfigurator extends EquinoxLifecycleListener {
|
|
@Requirement
|
|
private LegacySupport context;
|
|
|
|
+ @Requirement
|
|
+ private RepositorySystem repositorySystem;
|
|
+
|
|
@Override
|
|
public void afterFrameworkStarted(EmbeddedEquinox framework) {
|
|
MavenSession session = context.getSession();
|
|
@@ -46,7 +51,7 @@ public class MavenContextConfigurator extends EquinoxLifecycleListener {
|
|
MavenLoggerAdapter mavenLogger = new MavenLoggerAdapter(logger, false);
|
|
Properties globalProps = getGlobalProperties(session);
|
|
MavenContextImpl mavenContext = new MavenContextImpl(localRepoRoot, session.isOffline(), mavenLogger,
|
|
- globalProps);
|
|
+ globalProps, new MavenRepositorySystemAdapter(repositorySystem));
|
|
for (MavenProject project : session.getProjects()) {
|
|
mavenContext.addProject(DefaultReactorProject.adapt(project));
|
|
}
|
|
--
|
|
2.28.0
|
|
|