Blame SOURCES/0003-Tycho-should-always-delegate-artifact-resolution-to-.patch

35a07c
From 2e005b107e6abda5bf09a963a54833cedabfba99 Mon Sep 17 00:00:00 2001
35a07c
From: Roland Grunberg <rgrunber@redhat.com>
35a07c
Date: Wed, 18 Jun 2014 13:01:31 -0400
35a07c
Subject: [PATCH 3/6] Tycho should always delegate artifact resolution to
35a07c
 Maven.
35a07c
35a07c
Maven resolves dependencies from the following locations in the
35a07c
following order:
35a07c
    * reactor,
35a07c
    * workspace (eg. XMvn),
35a07c
    * local repository,
35a07c
    * remote repositories.
35a07c
35a07c
Tycho assumes that all resolved artifacts are present within the reactor
35a07c
cache but this is not true for artifacts resolved from workspace
35a07c
locations.
35a07c
35a07c
Change-Id: Ia44969ed1064965a82c3507a63e54caeebb75b18
35a07c
---
35a07c
 .../META-INF/MANIFEST.MF                      |  1 +
35a07c
 .../tycho/core/shared/MavenContext.java       |  2 +
35a07c
 .../tycho/core/shared/MavenContextImpl.java   | 10 +++-
35a07c
 .../core/shared/MavenRepositorySystem.java    | 19 +++++++
35a07c
 .../LocalArtifactRepositoryP2APITest.java     |  4 +-
35a07c
 .../local/LocalMetadataRepositoryTest.java    |  3 +-
35a07c
 .../local/LocalArtifactRepository.java        |  8 +--
35a07c
 .../local/LocalArtifactRepositoryFactory.java |  3 +-
35a07c
 .../index/LocalRepositoryP2IndicesImpl.java   |  7 +++
35a07c
 .../remote/RemoteAgentMavenMirrorsTest.java   |  3 +-
35a07c
 ...emoteAgentMetadataRepositoryCacheTest.java |  5 +-
35a07c
 .../TargetPlatformBundlePublisherTest.java    |  3 +-
35a07c
 .../tycho/p2/target/TestResolverFactory.java  |  5 +-
35a07c
 .../p2/resolver/P2ResolverFactoryImpl.java    |  8 +--
35a07c
 .../p2/target/PomDependencyCollectorImpl.java |  2 +-
35a07c
 .../target/TargetPlatformBundlePublisher.java | 13 +++--
35a07c
 .../repository/LocalRepositoryP2Indices.java  |  4 ++
35a07c
 .../p2/repository/LocalRepositoryReader.java  | 49 +++++--------------
35a07c
 .../TemporaryLocalMavenRepository.java        |  4 +-
35a07c
 .../test/util/MavenRepositorySystemStub.java  | 30 ++++++++++++
35a07c
 .../MavenRepositorySystemAdapter.java         | 37 ++++++++++++++
35a07c
 .../MavenContextConfigurator.java             |  8 ++-
35a07c
 22 files changed, 166 insertions(+), 62 deletions(-)
35a07c
 create mode 100644 tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenRepositorySystem.java
35a07c
 create mode 100644 tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/MavenRepositorySystemStub.java
35a07c
 create mode 100644 tycho-core/src/main/java/org/eclipse/tycho/osgi/adapters/MavenRepositorySystemAdapter.java
35a07c
35a07c
diff --git a/tycho-bundles/org.eclipse.tycho.core.shared.tests/META-INF/MANIFEST.MF b/tycho-bundles/org.eclipse.tycho.core.shared.tests/META-INF/MANIFEST.MF
35a07c
index ef464f8..05ac727 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.core.shared.tests/META-INF/MANIFEST.MF
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.core.shared.tests/META-INF/MANIFEST.MF
35a07c
@@ -8,3 +8,4 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
35a07c
 Require-Bundle: org.junit;bundle-version="4.8.2"
35a07c
 Bundle-Vendor: %providerName
35a07c
 Automatic-Module-Name: org.eclipse.tycho.core.shared.tests
35a07c
+Import-Package: org.eclipse.tycho.p2.repository
35a07c
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
35a07c
index d63c1f1..cd8594d 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContext.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContext.java
35a07c
@@ -38,4 +38,6 @@ public interface MavenContext {
35a07c
      */
35a07c
     public Properties getSessionProperties();
35a07c
 
35a07c
+    public MavenRepositorySystem getRepositorySystem();
35a07c
+
35a07c
 }
35a07c
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
35a07c
index d9f7bc6..683772c 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContextImpl.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContextImpl.java
35a07c
@@ -19,18 +19,20 @@ public class MavenContextImpl implements MavenContext {
35a07c
     private MavenLogger mavenLogger;
35a07c
     private boolean offline;
35a07c
     private Properties mergedProperties;
35a07c
+    private MavenRepositorySystem repositorySystem;
35a07c
 
35a07c
     public MavenContextImpl(File localRepositoryRoot, boolean offline, MavenLogger mavenLogger,
35a07c
-            Properties mergedProperties) {
35a07c
+            Properties mergedProperties, MavenRepositorySystem repositorySystem) {
35a07c
         this.localRepositoryRoot = localRepositoryRoot;
35a07c
         this.offline = offline;
35a07c
         this.mavenLogger = mavenLogger;
35a07c
         this.mergedProperties = mergedProperties;
35a07c
+        this.repositorySystem = repositorySystem;
35a07c
     }
35a07c
 
35a07c
     // constructor for tests
35a07c
     public MavenContextImpl(File localRepositoryRoot, MavenLogger mavenLogger) {
35a07c
-        this(localRepositoryRoot, false, mavenLogger, new Properties());
35a07c
+        this(localRepositoryRoot, false, mavenLogger, new Properties(), null);
35a07c
     }
35a07c
 
35a07c
     @Override
35a07c
@@ -53,4 +55,8 @@ public class MavenContextImpl implements MavenContext {
35a07c
         return mergedProperties;
35a07c
     }
35a07c
 
35a07c
+    public MavenRepositorySystem getRepositorySystem() {
35a07c
+        return repositorySystem;
35a07c
+    }
35a07c
+
35a07c
 }
35a07c
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
35a07c
new file mode 100644
35a07c
index 0000000..965e5cd
35a07c
--- /dev/null
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenRepositorySystem.java
35a07c
@@ -0,0 +1,19 @@
35a07c
+/*******************************************************************************
35a07c
+ * Copyright (c) 2014 Red Hat Inc.
35a07c
+ * All rights reserved. This program and the accompanying materials
35a07c
+ * are made available under the terms of the Eclipse Public License v1.0
35a07c
+ * which accompanies this distribution, and is available at
35a07c
+ * http://www.eclipse.org/legal/epl-v10.html
35a07c
+ *
35a07c
+ * Contributors:
35a07c
+ *     Red Hat Inc. - initial API and implementation
35a07c
+ *******************************************************************************/
35a07c
+package org.eclipse.tycho.core.shared;
35a07c
+
35a07c
+import java.io.File;
35a07c
+
35a07c
+public interface MavenRepositorySystem {
35a07c
+
35a07c
+    public File resolve(String gid, String aid, String version, String type, String classifier);
35a07c
+
35a07c
+}
35a07c
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
35a07c
index 7bf376b..781b53f 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryP2APITest.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryP2APITest.java
35a07c
@@ -53,6 +53,7 @@ import org.eclipse.tycho.repository.p2base.artifact.repository.ArtifactRepositor
35a07c
 import org.eclipse.tycho.repository.streaming.testutil.ProbeArtifactSink;
35a07c
 import org.eclipse.tycho.repository.streaming.testutil.ProbeOutputStream;
35a07c
 import org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink;
35a07c
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
35a07c
 import org.junit.After;
35a07c
 import org.junit.Before;
35a07c
 import org.junit.Rule;
35a07c
@@ -114,7 +115,8 @@ public class LocalArtifactRepositoryP2APITest {
35a07c
     @Before
35a07c
     public void initSubject() throws Exception {
35a07c
         temporaryLocalMavenRepo.initContentFromResourceFolder(ResourceUtil.resourceFile("repositories/local"));
35a07c
-        subject = new LocalArtifactRepository(null, temporaryLocalMavenRepo.getLocalRepositoryIndex());
35a07c
+        subject = new LocalArtifactRepository(null, temporaryLocalMavenRepo.getLocalRepositoryIndex(),
35a07c
+                new MavenRepositorySystemStub(temporaryLocalMavenRepo.getLocalRepositoryRoot()));
35a07c
 
35a07c
         testOutputStream = new ProbeOutputStream();
35a07c
     }
35a07c
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
35a07c
index 1695b0f..52ac568 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalMetadataRepositoryTest.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalMetadataRepositoryTest.java
35a07c
@@ -30,6 +30,7 @@ import org.eclipse.tycho.p2.repository.LocalRepositoryReader;
35a07c
 import org.eclipse.tycho.p2.repository.RepositoryLayoutHelper;
35a07c
 import org.eclipse.tycho.p2.repository.TychoRepositoryIndex;
35a07c
 import org.eclipse.tycho.repository.local.index.FileBasedTychoRepositoryIndex;
35a07c
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
35a07c
 import org.junit.Assert;
35a07c
 import org.junit.Test;
35a07c
 
35a07c
@@ -47,7 +48,7 @@ public class LocalMetadataRepositoryTest extends BaseMavenRepositoryTest {
35a07c
 
35a07c
     protected IMetadataRepository loadRepository(File location) throws ProvisionException {
35a07c
         return new LocalMetadataRepository(location.toURI(), createMetadataIndex(location),
35a07c
-                new LocalRepositoryReader(location));
35a07c
+                new LocalRepositoryReader(location, new MavenRepositorySystemStub(location)));
35a07c
     }
35a07c
 
35a07c
     private LocalMetadataRepository createRepository(File location) throws ProvisionException {
35a07c
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
35a07c
index 6e45753..406c1dc 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepository.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepository.java
35a07c
@@ -23,6 +23,7 @@ import java.util.Set;
35a07c
 import org.eclipse.equinox.p2.core.IProvisioningAgent;
35a07c
 import org.eclipse.equinox.p2.metadata.IArtifactKey;
35a07c
 import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
35a07c
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
35a07c
 import org.eclipse.tycho.p2.maven.repository.Activator;
35a07c
 import org.eclipse.tycho.p2.maven.repository.xmlio.ArtifactsIO;
35a07c
 import org.eclipse.tycho.p2.repository.GAV;
35a07c
@@ -42,15 +43,16 @@ public class LocalArtifactRepository extends ArtifactRepositoryBaseImpl
35a07c
 
35a07c
     // TODO what is the agent needed for? does using the default agent harm?
35a07c
     public LocalArtifactRepository(LocalRepositoryP2Indices localRepoIndices) {
35a07c
-        this(Activator.getProvisioningAgent(), localRepoIndices);
35a07c
+        this(Activator.getProvisioningAgent(), localRepoIndices, (MavenRepositorySystem) null);
35a07c
     }
35a07c
 
35a07c
     public LocalArtifactRepository(LocalRepositoryP2Indices localRepoIndices, RepositoryReader contentLocator) {
35a07c
         this(Activator.getProvisioningAgent(), localRepoIndices, contentLocator);
35a07c
     }
35a07c
 
35a07c
-    public LocalArtifactRepository(IProvisioningAgent agent, LocalRepositoryP2Indices localRepoIndices) {
35a07c
-        this(agent, localRepoIndices, new LocalRepositoryReader(localRepoIndices.getBasedir()));
35a07c
+    public LocalArtifactRepository(IProvisioningAgent agent, LocalRepositoryP2Indices localRepoIndices,
35a07c
+            MavenRepositorySystem repositorySystem) {
35a07c
+        this(agent, localRepoIndices, new LocalRepositoryReader(localRepoIndices.getBasedir(), repositorySystem));
35a07c
     }
35a07c
 
35a07c
     public LocalArtifactRepository(IProvisioningAgent agent, LocalRepositoryP2Indices localRepoIndices,
35a07c
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
35a07c
index 8356f46..34ac8fc 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryFactory.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryFactory.java
35a07c
@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
35a07c
 import org.eclipse.equinox.p2.core.ProvisionException;
35a07c
 import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
35a07c
 import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactRepositoryFactory;
35a07c
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
35a07c
 import org.eclipse.tycho.p2.maven.repository.Activator;
35a07c
 import org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices;
35a07c
 import org.eclipse.tycho.repository.util.internal.RepositoryFactoryTools;
35a07c
@@ -41,7 +42,7 @@ public class LocalArtifactRepositoryFactory extends ArtifactRepositoryFactory {
35a07c
             if (localRepositoryDirectory.isDirectory()
35a07c
                     && new File(localRepositoryDirectory, ".meta/p2-artifacts.properties").exists()) {
35a07c
                 // see FileBasedTychoRepositoryIndex#ARTIFACTS_INDEX_RELPATH
35a07c
-                return new LocalArtifactRepository(getAgent(), lookupLocalRepoIndices());
35a07c
+                return new LocalArtifactRepository(getAgent(), lookupLocalRepoIndices(), lookupLocalRepoIndices().getRepositorySystem());
35a07c
             }
35a07c
         }
35a07c
         return null;
35a07c
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
35a07c
index ccc9f64..7f06ecd 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/index/LocalRepositoryP2IndicesImpl.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/index/LocalRepositoryP2IndicesImpl.java
35a07c
@@ -15,6 +15,7 @@ import java.io.File;
35a07c
 
35a07c
 import org.eclipse.tycho.core.shared.MavenContext;
35a07c
 import org.eclipse.tycho.core.shared.MavenLogger;
35a07c
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
35a07c
 import org.eclipse.tycho.locking.facade.FileLockService;
35a07c
 import org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices;
35a07c
 import org.eclipse.tycho.p2.repository.TychoRepositoryIndex;
35a07c
@@ -25,6 +26,7 @@ public class LocalRepositoryP2IndicesImpl implements LocalRepositoryP2Indices {
35a07c
     private FileLockService fileLockService;
35a07c
     private File localRepositoryRoot;
35a07c
     private MavenLogger logger;
35a07c
+    private MavenRepositorySystem repoSystem;
35a07c
 
35a07c
     // derived members
35a07c
     private boolean initialized = false;
35a07c
@@ -39,6 +41,7 @@ public class LocalRepositoryP2IndicesImpl implements LocalRepositoryP2Indices {
35a07c
     public void setMavenContext(MavenContext mavenContext) {
35a07c
         this.localRepositoryRoot = mavenContext.getLocalRepositoryRoot();
35a07c
         this.logger = mavenContext.getLogger();
35a07c
+        this.repoSystem = mavenContext.getRepositorySystem();
35a07c
     }
35a07c
 
35a07c
     // injected by DS runtime
35a07c
@@ -80,4 +83,8 @@ public class LocalRepositoryP2IndicesImpl implements LocalRepositoryP2Indices {
35a07c
         return localRepositoryRoot;
35a07c
     }
35a07c
 
35a07c
+    public MavenRepositorySystem getRepositorySystem() {
35a07c
+        return repoSystem;
35a07c
+    }
35a07c
+
35a07c
 }
35a07c
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
35a07c
index 432ec09..4e5566a 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMavenMirrorsTest.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMavenMirrorsTest.java
35a07c
@@ -29,6 +29,7 @@ import org.eclipse.tycho.p2.impl.test.ResourceUtil;
35a07c
 import org.eclipse.tycho.p2.remote.testutil.MavenRepositorySettingsStub;
35a07c
 import org.eclipse.tycho.test.util.HttpServer;
35a07c
 import org.eclipse.tycho.test.util.LogVerifier;
35a07c
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
35a07c
 import org.junit.Before;
35a07c
 import org.junit.Rule;
35a07c
 import org.junit.Test;
35a07c
@@ -52,7 +53,7 @@ public class RemoteAgentMavenMirrorsTest {
35a07c
     public void initSubject() throws Exception {
35a07c
         File localRepository = tempManager.newFolder("localRepo");
35a07c
         MavenContext mavenContext = new MavenContextImpl(localRepository, OFFLINE, logVerifier.getLogger(),
35a07c
-                new Properties());
35a07c
+                new Properties(), new MavenRepositorySystemStub(localRepository));
35a07c
 
35a07c
         mavenRepositorySettings = new MavenRepositorySettingsStub();
35a07c
         subject = new RemoteAgent(mavenContext, mavenRepositorySettings, OFFLINE);
35a07c
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
35a07c
index ae31862..14b8f85 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMetadataRepositoryCacheTest.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMetadataRepositoryCacheTest.java
35a07c
@@ -26,6 +26,7 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
35a07c
 import org.eclipse.tycho.core.shared.MavenContextImpl;
35a07c
 import org.eclipse.tycho.test.util.HttpServer;
35a07c
 import org.eclipse.tycho.test.util.LogVerifier;
35a07c
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
35a07c
 import org.junit.Before;
35a07c
 import org.junit.Rule;
35a07c
 import org.junit.Test;
35a07c
@@ -126,12 +127,12 @@ public class RemoteAgentMetadataRepositoryCacheTest {
35a07c
 
35a07c
     private RemoteAgent newOnlineAgent() throws Exception {
35a07c
         return new RemoteAgent(new MavenContextImpl(localMavenRepository, false, logVerifier.getLogger(),
35a07c
-                new Properties()));
35a07c
+                new Properties(), new MavenRepositorySystemStub(localMavenRepository)));
35a07c
     }
35a07c
 
35a07c
     private RemoteAgent newOfflineAgent() throws Exception {
35a07c
         return new RemoteAgent(new MavenContextImpl(localMavenRepository, true, logVerifier.getLogger(),
35a07c
-                new Properties()));
35a07c
+                new Properties(), new MavenRepositorySystemStub(localMavenRepository)));
35a07c
     }
35a07c
 
35a07c
     private IMetadataRepository loadHttpRepository(RemoteAgent agent) throws ProvisionException {
35a07c
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
35a07c
index f4a356f..e332785 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisherTest.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisherTest.java
35a07c
@@ -32,6 +32,7 @@ import org.eclipse.tycho.p2.repository.RepositoryLayoutHelper;
35a07c
 import org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactProvider;
35a07c
 import org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink;
35a07c
 import org.eclipse.tycho.test.util.LogVerifier;
35a07c
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
35a07c
 import org.junit.Before;
35a07c
 import org.junit.Rule;
35a07c
 import org.junit.Test;
35a07c
@@ -57,7 +58,7 @@ public class TargetPlatformBundlePublisherTest {
35a07c
         logVerifier.expectNoWarnings();
35a07c
 
35a07c
         localRepositoryRoot = tempFolder.getRoot();
35a07c
-        subject = new TargetPlatformBundlePublisher(localRepositoryRoot, logVerifier.getLogger());
35a07c
+        subject = new TargetPlatformBundlePublisher(localRepositoryRoot, logVerifier.getLogger(), new MavenRepositorySystemStub(localRepositoryRoot));
35a07c
     }
35a07c
 
35a07c
     @Test
35a07c
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
35a07c
index 4b44fdd..342437b 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TestResolverFactory.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TestResolverFactory.java
35a07c
@@ -28,6 +28,7 @@ import org.eclipse.tycho.p2.target.facade.TargetPlatformFactory;
35a07c
 import org.eclipse.tycho.repository.local.LocalArtifactRepository;
35a07c
 import org.eclipse.tycho.repository.local.LocalMetadataRepository;
35a07c
 import org.eclipse.tycho.repository.local.index.LocalRepositoryP2IndicesImpl;
35a07c
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
35a07c
 import org.eclipse.tycho.test.util.NoopFileLockService;
35a07c
 
35a07c
 public class TestResolverFactory implements P2ResolverFactory {
35a07c
@@ -45,7 +46,7 @@ public class TestResolverFactory implements P2ResolverFactory {
35a07c
 
35a07c
         File localMavenRepoRoot = mavenContext.getLocalRepositoryRoot();
35a07c
         LocalRepositoryP2Indices localRepoIndices = createLocalRepoIndices(mavenContext);
35a07c
-        LocalRepositoryReader localRepositoryReader = new LocalRepositoryReader(localMavenRepoRoot);
35a07c
+        LocalRepositoryReader localRepositoryReader = new LocalRepositoryReader(localMavenRepoRoot, mavenContext.getRepositorySystem());
35a07c
         localMetadataRepo = new LocalMetadataRepository(localMavenRepoRoot.toURI(),
35a07c
                 localRepoIndices.getMetadataIndex(), localRepositoryReader);
35a07c
         localArtifactRepo = new LocalArtifactRepository(localRepoIndices, localRepositoryReader);
35a07c
@@ -56,7 +57,7 @@ public class TestResolverFactory implements P2ResolverFactory {
35a07c
     }
35a07c
 
35a07c
     private MavenContext createMavenContext(boolean offline, MavenLogger logger) {
35a07c
-        return new MavenContextImpl(getLocalRepositoryLocation(), offline, logger, new Properties());
35a07c
+        return new MavenContextImpl(getLocalRepositoryLocation(), offline, logger, new Properties(), new MavenRepositorySystemStub(getLocalRepositoryLocation()));
35a07c
     }
35a07c
 
35a07c
     // TODO use TemporaryLocalMavenRepository
35a07c
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
35a07c
index 1e6050c..2fee3b2 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/resolver/P2ResolverFactoryImpl.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/resolver/P2ResolverFactoryImpl.java
35a07c
@@ -33,7 +33,7 @@ public class P2ResolverFactoryImpl implements P2ResolverFactory {
35a07c
     private static LocalMetadataRepository localMetadataRepository;
35a07c
     private static LocalArtifactRepository localArtifactRepository;
35a07c
 
35a07c
-    private MavenContext mavenContext;
35a07c
+    private static MavenContext mavenContext;
35a07c
     private LocalRepositoryP2Indices localRepoIndices;
35a07c
     private RemoteAgentManager remoteAgentManager;
35a07c
     private TargetDefinitionResolverService targetDefinitionResolverService;
35a07c
@@ -42,7 +42,8 @@ public class P2ResolverFactoryImpl implements P2ResolverFactory {
35a07c
             LocalRepositoryP2Indices localRepoIndices) {
35a07c
         if (localMetadataRepository == null) {
35a07c
             File localMavenRepoRoot = context.getLocalRepositoryRoot();
35a07c
-            RepositoryReader contentLocator = new LocalRepositoryReader(localMavenRepoRoot);
35a07c
+            RepositoryReader contentLocator = new LocalRepositoryReader(localMavenRepoRoot,
35a07c
+                    mavenContext.getRepositorySystem());
35a07c
             localMetadataRepository = new LocalMetadataRepository(localMavenRepoRoot.toURI(),
35a07c
                     localRepoIndices.getMetadataIndex(), contentLocator);
35a07c
 
35a07c
@@ -53,7 +54,8 @@ public class P2ResolverFactoryImpl implements P2ResolverFactory {
35a07c
     private static synchronized LocalArtifactRepository getLocalArtifactRepository(MavenContext mavenContext,
35a07c
             LocalRepositoryP2Indices localRepoIndices) {
35a07c
         if (localArtifactRepository == null) {
35a07c
-            RepositoryReader contentLocator = new LocalRepositoryReader(mavenContext.getLocalRepositoryRoot());
35a07c
+            RepositoryReader contentLocator = new LocalRepositoryReader(mavenContext.getLocalRepositoryRoot(),
35a07c
+                    mavenContext.getRepositorySystem());
35a07c
             localArtifactRepository = new LocalArtifactRepository(localRepoIndices, contentLocator);
35a07c
         }
35a07c
         return localArtifactRepository;
35a07c
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
35a07c
index c7eabd1..6821461 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/PomDependencyCollectorImpl.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/PomDependencyCollectorImpl.java
35a07c
@@ -44,7 +44,7 @@ public class PomDependencyCollectorImpl implements PomDependencyCollector {
35a07c
         this.logger = mavenContext.getLogger();
35a07c
 
35a07c
         File localRepositoryRoot = mavenContext.getLocalRepositoryRoot();
35a07c
-        this.bundlesPublisher = new TargetPlatformBundlePublisher(localRepositoryRoot, mavenContext.getLogger());
35a07c
+        this.bundlesPublisher = new TargetPlatformBundlePublisher(localRepositoryRoot, mavenContext.getLogger(), mavenContext.getRepositorySystem());
35a07c
     }
35a07c
 
35a07c
     @Override
35a07c
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
35a07c
index 0d15db9..a5f8822 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisher.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisher.java
35a07c
@@ -25,6 +25,7 @@ import org.eclipse.equinox.p2.publisher.PublisherResult;
35a07c
 import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction;
35a07c
 import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
35a07c
 import org.eclipse.tycho.core.shared.MavenLogger;
35a07c
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
35a07c
 import org.eclipse.tycho.p2.impl.publisher.MavenPropertiesAdvice;
35a07c
 import org.eclipse.tycho.p2.impl.publisher.repo.TransientArtifactRepository;
35a07c
 import org.eclipse.tycho.p2.metadata.IArtifactFacade;
35a07c
@@ -42,8 +43,9 @@ public class TargetPlatformBundlePublisher {
35a07c
     private final MavenLogger logger;
35a07c
     private final PublishedBundlesArtifactRepository publishedArtifacts;
35a07c
 
35a07c
-    public TargetPlatformBundlePublisher(File localMavenRepositoryRoot, MavenLogger logger) {
35a07c
-        this.publishedArtifacts = new PublishedBundlesArtifactRepository(localMavenRepositoryRoot);
35a07c
+    public TargetPlatformBundlePublisher(File localMavenRepositoryRoot, MavenLogger logger,
35a07c
+            MavenRepositorySystem repositorySystem) {
35a07c
+        this.publishedArtifacts = new PublishedBundlesArtifactRepository(localMavenRepositoryRoot, repositorySystem);
35a07c
         this.logger = logger;
35a07c
     }
35a07c
 
35a07c
@@ -204,8 +206,11 @@ public class TargetPlatformBundlePublisher {
35a07c
      */
35a07c
     private static class PublishedBundlesArtifactRepository extends ArtifactRepositoryBaseImpl<GAVArtifactDescriptor> {
35a07c
 
35a07c
-        PublishedBundlesArtifactRepository(File localMavenRepositoryRoot) {
35a07c
+        private MavenRepositorySystem repositorySystem;
35a07c
+
35a07c
+        PublishedBundlesArtifactRepository(File localMavenRepositoryRoot, MavenRepositorySystem repositorySystem) {
35a07c
             super(null, localMavenRepositoryRoot.toURI(), ArtifactTransferPolicies.forLocalArtifacts());
35a07c
+            this.repositorySystem = repositorySystem;
35a07c
         }
35a07c
 
35a07c
         void addPublishedArtifact(IArtifactDescriptor baseDescriptor, IArtifactFacade mavenArtifact) {
35a07c
@@ -250,7 +255,7 @@ public class TargetPlatformBundlePublisher {
35a07c
         @Override
35a07c
         protected File internalGetArtifactStorageLocation(IArtifactDescriptor descriptor) {
35a07c
             MavenRepositoryCoordinates coord = toInternalDescriptor(descriptor).getMavenCoordinates();
35a07c
-            LocalRepositoryReader reader = new LocalRepositoryReader(getBaseDir());
35a07c
+            LocalRepositoryReader reader = new LocalRepositoryReader(getBaseDir(), repositorySystem);
35a07c
             return reader.getLocalArtifactLocation(coord.getGav(), coord.getClassifier(), coord.getExtensionOrDefault());
35a07c
         }
35a07c
 
35a07c
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
35a07c
index 2122578..5e4a01e 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryP2Indices.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryP2Indices.java
35a07c
@@ -13,6 +13,8 @@ package org.eclipse.tycho.p2.repository;
35a07c
 
35a07c
 import java.io.File;
35a07c
 
35a07c
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
35a07c
+
35a07c
 /**
35a07c
  * This service provides access to the tycho p2 index files of the local maven repository.
35a07c
  */
35a07c
@@ -24,4 +26,6 @@ public interface LocalRepositoryP2Indices {
35a07c
 
35a07c
     public File getBasedir();
35a07c
 
35a07c
+    public MavenRepositorySystem getRepositorySystem();
35a07c
+
35a07c
 }
35a07c
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
35a07c
index 74b8028..1aeb3ac 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java
35a07c
@@ -14,55 +14,28 @@ import java.io.File;
35a07c
 import java.lang.reflect.Constructor;
35a07c
 import java.lang.reflect.Method;
35a07c
 
35a07c
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
35a07c
+
35a07c
 public class LocalRepositoryReader implements RepositoryReader {
35a07c
 
35a07c
     private final File localMavenRepositoryRoot;
35a07c
+    private final MavenRepositorySystem repositorySystem;
35a07c
 
35a07c
-    public LocalRepositoryReader(File localMavenRepositoryRoot) {
35a07c
+    public LocalRepositoryReader(File localMavenRepositoryRoot, MavenRepositorySystem repositorySystem) {
35a07c
         this.localMavenRepositoryRoot = localMavenRepositoryRoot;
35a07c
+        this.repositorySystem = repositorySystem;
35a07c
     }
35a07c
 
35a07c
     @Override
35a07c
     @SuppressWarnings({ "unchecked", "rawtypes" })
35a07c
     public File getLocalArtifactLocation(GAV gav, String classifier, String extension) {
35a07c
-        File file = new File(localMavenRepositoryRoot, RepositoryLayoutHelper.getRelativePath(gav, classifier,
35a07c
-                extension));
35a07c
-        // In Fedora the artifact may be in an XMvn-defined repository location (not in reactor cache)
35a07c
-        if (!file.exists()) {
35a07c
-            try {
35a07c
-                // Create Plexus config
35a07c
-                Class pcclazz = Class.forName("org.codehaus.plexus.ContainerConfiguration");
35a07c
-                Object conf = Class.forName("org.codehaus.plexus.DefaultContainerConfiguration").newInstance();
35a07c
-                pcclazz.getMethod("setAutoWiring", boolean.class).invoke(conf, true);
35a07c
-                pcclazz.getMethod("setClassPathScanning", String.class).invoke(conf, "index");
35a07c
-
35a07c
-                // Use plexus container to lookup the reader
35a07c
-                Class pclazz = Class.forName("org.codehaus.plexus.DefaultPlexusContainer");
35a07c
-                Object plexus = pclazz.getConstructor(pcclazz).newInstance(conf);
35a07c
-
35a07c
-                // Retrieve the workspace reader from the plexus container
35a07c
-                Method mLookup = pclazz.getMethod("lookup", String.class, String.class);
35a07c
-                Object reader = mLookup.invoke(plexus, "org.eclipse.aether.repository.WorkspaceReader", "ide");
35a07c
-
35a07c
-                // Create an Aether Artifact based on GAV, classifier, and extension
35a07c
-                Class iartclazz = Class.forName("org.eclipse.aether.artifact.Artifact");
35a07c
-                Class artclazz = Class.forName("org.eclipse.aether.artifact.DefaultArtifact");
35a07c
-                Constructor cNew = artclazz.getConstructor(String.class, String.class, String.class, String.class,
35a07c
-                        String.class);
35a07c
-                Object artifact = cNew.newInstance(gav.getGroupId(), gav.getArtifactId(), classifier, extension,
35a07c
-                        gav.getVersion());
35a07c
-
35a07c
-                // Invoke "findArtifact" method of the workspace reader on the artifact
35a07c
-                Method mfindArtifact = reader.getClass().getMethod("findArtifact", iartclazz);
35a07c
-                File newFile = (File) mfindArtifact.invoke(reader, artifact);
35a07c
-                if (newFile != null) {
35a07c
-                    file = newFile;
35a07c
-                }
35a07c
-            } catch (Exception e) {
35a07c
-                e.printStackTrace();
35a07c
+        File ret = new File(localMavenRepositoryRoot, RepositoryLayoutHelper.getRelativePath(gav, classifier, extension));
35a07c
+        if (repositorySystem != null) {
35a07c
+            File tmp = repositorySystem.resolve(gav.getGroupId(), gav.getArtifactId(), gav.getVersion(), extension, classifier);
35a07c
+            if (tmp != null) {
35a07c
+                ret = tmp;
35a07c
             }
35a07c
         }
35a07c
-        return file;
35a07c
-
35a07c
+        return ret;
35a07c
     }
35a07c
 }
35a07c
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
35a07c
index 5c0bcb8..3d05393 100644
35a07c
--- a/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/repository/local/testutil/TemporaryLocalMavenRepository.java
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/repository/local/testutil/TemporaryLocalMavenRepository.java
35a07c
@@ -14,9 +14,11 @@ import java.io.File;
35a07c
 import java.io.IOException;
35a07c
 
35a07c
 import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
35a07c
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
35a07c
 import org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices;
35a07c
 import org.eclipse.tycho.repository.local.LocalArtifactRepository;
35a07c
 import org.eclipse.tycho.repository.local.index.LocalRepositoryP2IndicesImpl;
35a07c
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
35a07c
 import org.eclipse.tycho.test.util.NoopFileLockService;
35a07c
 import org.junit.Rule;
35a07c
 import org.junit.rules.ExternalResource;
35a07c
@@ -72,7 +74,7 @@ public class TemporaryLocalMavenRepository extends ExternalResource {
35a07c
 
35a07c
     public LocalArtifactRepository getLocalArtifactRepository() {
35a07c
         if (repo == null) {
35a07c
-            repo = new LocalArtifactRepository(null, getLocalRepositoryIndex());
35a07c
+            repo = new LocalArtifactRepository(null, getLocalRepositoryIndex(), new MavenRepositorySystemStub(getLocalRepositoryRoot()));
35a07c
         }
35a07c
         return repo;
35a07c
     }
35a07c
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
35a07c
new file mode 100644
35a07c
index 0000000..7e020da
35a07c
--- /dev/null
35a07c
+++ b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/MavenRepositorySystemStub.java
35a07c
@@ -0,0 +1,30 @@
35a07c
+/*******************************************************************************
35a07c
+ * Copyright (c) 2014 Red Hat Inc.
35a07c
+ * All rights reserved. This program and the accompanying materials
35a07c
+ * are made available under the terms of the Eclipse Public License v1.0
35a07c
+ * which accompanies this distribution, and is available at
35a07c
+ * http://www.eclipse.org/legal/epl-v10.html
35a07c
+ *
35a07c
+ * Contributors:
35a07c
+ *     Red Hat Inc. - initial API and implementation
35a07c
+ *******************************************************************************/
35a07c
+package org.eclipse.tycho.test.util;
35a07c
+
35a07c
+import java.io.File;
35a07c
+
35a07c
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
35a07c
+import org.eclipse.tycho.p2.repository.RepositoryLayoutHelper;
35a07c
+
35a07c
+public class MavenRepositorySystemStub implements MavenRepositorySystem {
35a07c
+
35a07c
+    private File localMavenRepositoryRoot;
35a07c
+
35a07c
+    public MavenRepositorySystemStub(File localMavenRepositoryRoot) {
35a07c
+        this.localMavenRepositoryRoot = localMavenRepositoryRoot;
35a07c
+    }
35a07c
+
35a07c
+    public File resolve(String gid, String aid, String version, String type, String classifier) {
35a07c
+        return new File(localMavenRepositoryRoot, RepositoryLayoutHelper.getRelativePath(gid, aid, version, classifier,
35a07c
+                type));
35a07c
+    }
35a07c
+}
35a07c
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
35a07c
new file mode 100644
35a07c
index 0000000..e1d46fa
35a07c
--- /dev/null
35a07c
+++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/adapters/MavenRepositorySystemAdapter.java
35a07c
@@ -0,0 +1,37 @@
35a07c
+/*******************************************************************************
35a07c
+ * Copyright (c) 2014 Red Hat Inc.
35a07c
+ * All rights reserved. This program and the accompanying materials
35a07c
+ * are made available under the terms of the Eclipse Public License v1.0
35a07c
+ * which accompanies this distribution, and is available at
35a07c
+ * http://www.eclipse.org/legal/epl-v10.html
35a07c
+ *
35a07c
+ * Contributors:
35a07c
+ *     Red Hat Inc. - initial API and implementation
35a07c
+ *******************************************************************************/
35a07c
+package org.eclipse.tycho.osgi.adapters;
35a07c
+
35a07c
+import java.io.File;
35a07c
+
35a07c
+import org.apache.maven.artifact.Artifact;
35a07c
+import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
35a07c
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
35a07c
+import org.apache.maven.repository.RepositorySystem;
35a07c
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
35a07c
+
35a07c
+public class MavenRepositorySystemAdapter implements MavenRepositorySystem {
35a07c
+
35a07c
+    private RepositorySystem repoSystem;
35a07c
+
35a07c
+    public MavenRepositorySystemAdapter(RepositorySystem repoSystem) {
35a07c
+        this.repoSystem = repoSystem;
35a07c
+    }
35a07c
+
35a07c
+    public File resolve(String gid, String aid, String version, String type, String classifier) {
35a07c
+        ArtifactResolutionRequest req = new ArtifactResolutionRequest();
35a07c
+        Artifact art = repoSystem.createArtifactWithClassifier(gid, aid, version, type, classifier);
35a07c
+        req.setArtifact(art);
35a07c
+        ArtifactResolutionResult res = repoSystem.resolve(req);
35a07c
+        return res.getArtifacts().size() > 0 ? res.getArtifacts().toArray(new Artifact[0])[0].getFile() : null;
35a07c
+    }
35a07c
+
35a07c
+}
35a07c
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
35a07c
index e5837e2..137dcb1 100644
35a07c
--- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/MavenContextConfigurator.java
35a07c
+++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/MavenContextConfigurator.java
35a07c
@@ -16,6 +16,7 @@ import java.util.Properties;
35a07c
 
35a07c
 import org.apache.maven.execution.MavenSession;
35a07c
 import org.apache.maven.plugin.LegacySupport;
35a07c
+import org.apache.maven.repository.RepositorySystem;
35a07c
 import org.apache.maven.settings.Profile;
35a07c
 import org.apache.maven.settings.Settings;
35a07c
 import org.codehaus.plexus.component.annotations.Component;
35a07c
@@ -26,6 +27,7 @@ import org.eclipse.sisu.equinox.embedder.EquinoxLifecycleListener;
35a07c
 import org.eclipse.tycho.core.shared.MavenContext;
35a07c
 import org.eclipse.tycho.core.shared.MavenContextImpl;
35a07c
 import org.eclipse.tycho.osgi.adapters.MavenLoggerAdapter;
35a07c
+import org.eclipse.tycho.osgi.adapters.MavenRepositorySystemAdapter;
35a07c
 
35a07c
 @Component(role = EquinoxLifecycleListener.class, hint = "MavenContextConfigurator")
35a07c
 public class MavenContextConfigurator extends EquinoxLifecycleListener {
35a07c
@@ -36,13 +38,17 @@ public class MavenContextConfigurator extends EquinoxLifecycleListener {
35a07c
     @Requirement
35a07c
     private LegacySupport context;
35a07c
 
35a07c
+    @Requirement
35a07c
+    private RepositorySystem repositorySystem;
35a07c
+
35a07c
     @Override
35a07c
     public void afterFrameworkStarted(EmbeddedEquinox framework) {
35a07c
         MavenSession session = context.getSession();
35a07c
         File localRepoRoot = new File(session.getLocalRepository().getBasedir());
35a07c
         MavenLoggerAdapter mavenLogger = new MavenLoggerAdapter(logger, false);
35a07c
         Properties globalProps = getGlobalProperties(session);
35a07c
-        MavenContext mavenContext = new MavenContextImpl(localRepoRoot, session.isOffline(), mavenLogger, globalProps);
35a07c
+        MavenContext mavenContext = new MavenContextImpl(localRepoRoot, session.isOffline(), mavenLogger, globalProps,
35a07c
+                new MavenRepositorySystemAdapter(repositorySystem));
35a07c
         framework.registerService(MavenContext.class, mavenContext);
35a07c
     }
35a07c
 
35a07c
-- 
35a07c
2.20.1
35a07c