You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2015/12/29 13:10:39 UTC

Fwd: tomee git commit: getting rid of aether dependencies in openejb-provisionning and using shrinkwrap is available - which relies on maven - or our default impl if not. Note: the registration of this enhanced mvn resolver is still manual

a quick word for whom wondering why i deleted so much code:

- the Resolver API is no more used on 7.x by default - was dead code more
or less since the "fallback" impl has been enhanced a lot to match most of
cases without dependency
- the aether version we were using is no more compatible with mvn since few
mvn minor releases (= not usable)
- I moved it to usable code (if registered manually) for very advanced
cases - not the default where our mvn resolver seems good enough compared
to tomee 1.7 one
- it now relies on shrinkwrap maven which can be discussed but since this
module shouldnt be needed anymore I see it as a way to not maintain our
integration with aether and keep the same level of feature (SW does what we
did to summarize). I see this module (provisionning) as slowly dying and
think we could remove it for 7.0.0 version if we dont discover any feature
we miss cause our resolution API is not extensible.

Let me know if anything is wrong with this and if it breaks any tomee 7
usage I can have missed.

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

---------- Forwarded message ----------
From: <rm...@apache.org>
Date: 2015-12-29 13:05 GMT+01:00
Subject: tomee git commit: getting rid of aether dependencies in
openejb-provisionning and using shrinkwrap is available - which relies on
maven - or our default impl if not. Note: the registration of this enhanced
mvn resolver is still manual
To: commits@tomee.apache.org


Repository: tomee
Updated Branches:
  refs/heads/master b25b8bda8 -> c27dbf5d9


getting rid of aether dependencies in openejb-provisionning and using
shrinkwrap is available - which relies on maven - or our default impl if
not. Note: the registration of this enhanced mvn resolver is still manual


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/c27dbf5d
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/c27dbf5d
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/c27dbf5d

Branch: refs/heads/master
Commit: c27dbf5d9fb3f3c16fdad4e7eb8c8aa42afe1c11
Parents: b25b8bd
Author: Romain Manni-Bucau <rm...@gmail.com>
Authored: Tue Dec 29 13:05:24 2015 +0100
Committer: Romain Manni-Bucau <rm...@gmail.com>
Committed: Tue Dec 29 13:05:24 2015 +0100

----------------------------------------------------------------------
 utils/openejb-provisionning/pom.xml             | 139 +-------
 .../org/apache/openejb/resolver/Resolver.java   |  54 ++-
 .../resolver/maven/AetherBasedResolver.java     | 343 -------------------
 .../openejb/resolver/maven/ConfigHelper.java    |  35 --
 .../openejb/resolver/maven/Connection.java      |  47 ---
 .../apache/openejb/resolver/maven/Handler.java  |  29 --
 .../resolver/maven/ManualWagonProvider.java     |  38 --
 .../apache/openejb/resolver/maven/Parser.java   | 229 -------------
 .../resolver/maven/ShrinkwrapBridge.java        |  63 ++++
 .../openejb/resolver/maven/VersionResolver.java |  62 ----
 .../openejb/resolver/maven/package-info.java    |  19 -
 .../openejb/resolver/maven/ParserTest.java      | 241 -------------
 .../resolver/maven/SWMvnResolverTest.java       |  37 ++
 13 files changed, 126 insertions(+), 1210 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/c27dbf5d/utils/openejb-provisionning/pom.xml
----------------------------------------------------------------------
diff --git a/utils/openejb-provisionning/pom.xml
b/utils/openejb-provisionning/pom.xml
index e059d51..80b26f7 100644
--- a/utils/openejb-provisionning/pom.xml
+++ b/utils/openejb-provisionning/pom.xml
@@ -30,141 +30,10 @@
   <name>OpenEJB :: Utils :: Provisionning</name>

   <dependencies>
-    <!-- to handle mvn uris in DeployerEjb -->
     <dependency>
-      <groupId>org.ops4j.pax.url</groupId>
-      <artifactId>pax-url-maven-commons</artifactId>
-      <version>${pax-url.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.ops4j.pax.swissbox</groupId>
-          <artifactId>pax-swissbox-optional-jcl</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.sonatype.aether</groupId>
-      <artifactId>aether-api</artifactId>
-      <version>${aether.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.sonatype.aether</groupId>
-      <artifactId>aether-spi</artifactId>
-      <version>${aether.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.sonatype.aether</groupId>
-      <artifactId>aether-util</artifactId>
-      <version>${aether.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.sonatype.aether</groupId>
-      <artifactId>aether-impl</artifactId>
-      <version>${aether.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.sonatype.aether</groupId>
-      <artifactId>aether-connector-wagon</artifactId>
-      <version>${aether.version}</version>
-      <exclusions>
-        <exclusion>
-          <artifactId>plexus-utils</artifactId>
-          <groupId>org.codehaus.plexus</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>wagon-provider-api</artifactId>
-          <groupId>org.apache.maven.wagon</groupId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-aether-provider</artifactId>
-      <version>${maven.version}</version>
-      <exclusions>
-        <exclusion>
-          <artifactId>plexus-utils</artifactId>
-          <groupId>org.codehaus.plexus</groupId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven.wagon</groupId>
-      <artifactId>wagon-provider-api</artifactId>
-      <version>${wagon.version}</version>
-      <exclusions>
-        <exclusion>
-          <artifactId>plexus-utils</artifactId>
-          <groupId>org.codehaus.plexus</groupId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven.wagon</groupId>
-      <artifactId>wagon-file</artifactId>
-      <version>${wagon.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven.wagon</groupId>
-      <artifactId>wagon-http</artifactId>
-      <version>${wagon.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>commons-logging</groupId>
-          <artifactId>commons-logging</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>commons-io</groupId>
-          <artifactId>commons-io</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>commons-codec</groupId>
-      <artifactId>commons-codec</artifactId>
-      <version>${commons-codec.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-container-default</artifactId>
-      <version>${plexus.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>junit</groupId>
-          <artifactId>junit</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>log4j</groupId>
-          <artifactId>log4j</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>commons-logging</groupId>
-          <artifactId>commons-logging-api</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.apache.xbean</groupId>
-          <artifactId>xbean-reflect</artifactId>
-        </exclusion>
-        <exclusion>
-          <artifactId>plexus-utils</artifactId>
-          <groupId>org.codehaus.plexus</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>plexus-classworlds</artifactId>
-          <groupId>org.codehaus.plexus</groupId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-utils</artifactId>
-      <version>${plexus-utils.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
-      <version>1.1.1</version>
+      <groupId>org.jboss.shrinkwrap.resolver</groupId>
+      <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+      <version>${version.shrinkwrap.resolver.bom}</version>
     </dependency>

     <!-- for resolver -->
@@ -180,8 +49,6 @@
       <version>${project.version}</version>
       <scope>provided</scope>
     </dependency>
-
-
   </dependencies>

   <build>

http://git-wip-us.apache.org/repos/asf/tomee/blob/c27dbf5d/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/Resolver.java
----------------------------------------------------------------------
diff --git
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/Resolver.java
b/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/Resolver.java
index e21e952..9decef4 100644
---
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/Resolver.java
+++
b/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/Resolver.java
@@ -16,43 +16,35 @@
  */
 package org.apache.openejb.resolver;

-import org.apache.openejb.loader.IO;
-import org.apache.openejb.resolver.maven.Handler;
-import org.apache.openejb.resolver.maven.Parser;
+import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.loader.provisining.MavenResolver;
+import org.apache.openejb.loader.provisining.ProvisioningResolver;
+import org.apache.openejb.resolver.maven.ShrinkwrapBridge;

-import java.io.File;
-import java.net.URL;
+import java.io.FileInputStream;
+import java.io.InputStream;

-import static
org.apache.openejb.loader.provisining.ProvisioningResolver.cacheFile;
-
-public class Resolver {
-    public String resolve(final String rawLocation) throws Exception {
-        if (rawLocation.startsWith("mvn:") && rawLocation.length() >
"mvn:".length()) {
+public class Resolver extends MavenResolver {
+    public InputStream resolve(final String rawLocation) {
+        final boolean initialized = SystemInstance.isInitialized();
+        if (!initialized) {
+            SystemInstance.get().setComponent(ProvisioningResolver.class,
new ProvisioningResolver());
+        }

-            final String info = rawLocation.substring("mvn".length());
-            final Parser parser = new Parser(info);
-            final File file = cacheFile(parser.getArtifactPath());
-            if (!file.exists() || !file.canRead()) {
+        try {
+            if (rawLocation.startsWith("mvn:") && rawLocation.length() >
"mvn:".length()) {
                 try {
-                    final URL url = new
URL(rawLocation.substring("mvn:".length()), "localhost", -1, info, new
Handler());
-                    final File parentFile = file.getParentFile();
-                    if (!parentFile.exists()) {
-                        if (!parentFile.mkdirs()) {
-                            throw new Exception("Failed to create: " +
parentFile);
-                        }
-                    }
-                    IO.copy(IO.read(url), file);
-                } catch (Exception e) {
-                    if (file.exists()) {
-                        if (!file.delete()) {
-                            file.deleteOnExit();
-                        }
-                    }
-                    throw e;
+                    return new FileInputStream(new
ShrinkwrapBridge().resolve(rawLocation));
+                } catch (final Throwable th) {
+                    // try aether if not in a mvn build
+                    th.printStackTrace();
                 }
             }
-            return file.getPath();
+            return super.resolve(rawLocation);
+        } finally {
+            if (!initialized) {
+                SystemInstance.reset();
+            }
         }
-        return rawLocation;
     }
 }

http://git-wip-us.apache.org/repos/asf/tomee/blob/c27dbf5d/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/AetherBasedResolver.java
----------------------------------------------------------------------
diff --git
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/AetherBasedResolver.java
b/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/AetherBasedResolver.java
deleted file mode 100644
index 53b67e8..0000000
---
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/AetherBasedResolver.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.openejb.resolver.maven;
-
-import
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader;
-import org.apache.maven.repository.internal.DefaultVersionRangeResolver;
-import org.apache.maven.repository.internal.DefaultVersionResolver;
-import org.apache.maven.repository.internal.MavenRepositorySystemSession;
-import org.apache.openejb.loader.IO;
-import org.ops4j.pax.url.maven.commons.MavenConfigurationImpl;
-import org.ops4j.pax.url.maven.commons.MavenRepositoryURL;
-import org.sonatype.aether.RepositoryException;
-import org.sonatype.aether.RepositorySystem;
-import org.sonatype.aether.RepositorySystemSession;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.connector.wagon.WagonProvider;
-import org.sonatype.aether.connector.wagon.WagonRepositoryConnectorFactory;
-import org.sonatype.aether.impl.ArtifactDescriptorReader;
-import org.sonatype.aether.impl.DependencyCollector;
-import org.sonatype.aether.impl.Deployer;
-import org.sonatype.aether.impl.Installer;
-import org.sonatype.aether.impl.MetadataResolver;
-import org.sonatype.aether.impl.SyncContextFactory;
-import org.sonatype.aether.impl.VersionRangeResolver;
-import org.sonatype.aether.impl.VersionResolver;
-import org.sonatype.aether.impl.internal.DefaultDependencyCollector;
-import org.sonatype.aether.impl.internal.DefaultDeployer;
-import org.sonatype.aether.impl.internal.DefaultInstaller;
-import org.sonatype.aether.impl.internal.DefaultMetadataResolver;
-import org.sonatype.aether.impl.internal.DefaultServiceLocator;
-import org.sonatype.aether.impl.internal.DefaultSyncContextFactory;
-import
org.sonatype.aether.impl.internal.SimpleLocalRepositoryManagerFactory;
-import org.sonatype.aether.installation.InstallRequest;
-import org.sonatype.aether.repository.Authentication;
-import org.sonatype.aether.repository.LocalRepository;
-import org.sonatype.aether.repository.MirrorSelector;
-import org.sonatype.aether.repository.Proxy;
-import org.sonatype.aether.repository.ProxySelector;
-import org.sonatype.aether.repository.RemoteRepository;
-import org.sonatype.aether.resolution.ArtifactRequest;
-import org.sonatype.aether.resolution.VersionRangeRequest;
-import org.sonatype.aether.resolution.VersionRangeResolutionException;
-import org.sonatype.aether.resolution.VersionRangeResult;
-import org.sonatype.aether.spi.connector.RepositoryConnectorFactory;
-import org.sonatype.aether.spi.localrepo.LocalRepositoryManagerFactory;
-import org.sonatype.aether.spi.log.Logger;
-import org.sonatype.aether.spi.log.NullLogger;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
-import org.sonatype.aether.util.repository.DefaultMirrorSelector;
-import org.sonatype.aether.util.repository.DefaultProxySelector;
-import org.sonatype.aether.version.Version;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class AetherBasedResolver {
-    private static final String LATEST_VERSION_RANGE = "(0.0,]";
-    private static final String REPO_TYPE = "default";
-
-    final private RepositorySystem m_repoSystem;
-    final private List<RemoteRepository> m_remoteRepos;
-    final private MavenConfigurationImpl m_config;
-    final private MirrorSelector m_mirrorSelector;
-    final private ProxySelector m_proxySelector;
-    final private MavenRepositoryURL m_repositoryUrl;
-
-    /**
-     * Create a AetherBasedResolver
-     *
-     *
-     * @param configuration (must be not null)
-     * @param repositoryURL
-     * @throws java.net.MalformedURLException in case of url problems in
configuration.
-     */
-    public AetherBasedResolver(final MavenConfigurationImpl configuration,
MavenRepositoryURL repositoryURL) throws MalformedURLException {
-        m_repoSystem = newRepositorySystem();
-        m_config = configuration;
-
-        m_remoteRepos =
selectRepositories(getRemoteRepositories(configuration));
-        m_mirrorSelector = selectMirrors();
-        m_proxySelector = selectProxies();
-        m_repositoryUrl = repositoryURL;
-        assignProxyAndMirrors();
-    }
-
-    private void assignProxyAndMirrors() {
-        Map<String, List<String>> map = new HashMap<String,
List<String>>();
-        Map<String, RemoteRepository> naming = new HashMap<String,
RemoteRepository>();
-
-        for (RemoteRepository r : m_remoteRepos) {
-            naming.put(r.getId(), r);
-
-            r.setProxy(m_proxySelector.getProxy(r));
-
-            RemoteRepository mirror = m_mirrorSelector.getMirror(r);
-            if (mirror != null) {
-                String key = mirror.getId();
-                naming.put(key, mirror);
-                if (!map.containsKey(key)) {
-                    map.put(key, new ArrayList<String>());
-                }
-                List<String> mirrored = map.get(key);
-                mirrored.add(r.getId());
-            }
-        }
-
-        for (String mirrorId : map.keySet()) {
-            RemoteRepository mirror = naming.get(mirrorId);
-            List<RemoteRepository> mirroedRepos = new
ArrayList<RemoteRepository>();
-
-            for (String rep : map.get(mirrorId)) {
-                mirroedRepos.add(naming.get(rep));
-            }
-            mirror.setMirroredRepositories(mirroedRepos);
-            m_remoteRepos.removeAll(mirroedRepos);
-            m_remoteRepos.add(0, mirror);
-        }
-
-    }
-
-    private List<MavenRepositoryURL>
getRemoteRepositories(MavenConfigurationImpl configuration)
-            throws MalformedURLException {
-        List<MavenRepositoryURL> r = new ArrayList<MavenRepositoryURL>();
-        for (MavenRepositoryURL s : configuration.getRepositories()) {
-            r.add(s);
-        }
-        if (m_repositoryUrl != null) {
-            // 0 should be local so add it just after to downlad the
dependency quicker
-            r.add(r.size() == 0 ? 0 : 1, m_repositoryUrl);
-        }
-        r.add(new MavenRepositoryURL("
https://repository.apache.org/content/repositories/snapshots/@snapshots@id=apache-snapshot
"));
-        r.add(new MavenRepositoryURL("
https://repository.apache.org/content/repositories/releases/@id=apache-release
"));
-        return r;
-    }
-
-    private ProxySelector selectProxies() {
-        DefaultProxySelector proxySelector = new DefaultProxySelector();
-        Map<String, Map<String, String>> proxies =
m_config.getProxySettings();
-        for (Map<String, String> proxy : proxies.values()) {
-            //The fields are user, pass, host, port, nonProxyHosts,
protocol.
-            String nonProxyHosts = proxy.get("nonProxyHosts");
-            Proxy proxyObj = new Proxy(proxy.get("protocol"),
-                    proxy.get("host"),
-                    toInt(proxy.get("port")),
-                    getAuthentication(proxy)
-            );
-            proxySelector.add(proxyObj, nonProxyHosts);
-        }
-        return proxySelector;
-    }
-
-    private MirrorSelector selectMirrors() {
-        // configure mirror
-        DefaultMirrorSelector selector = new DefaultMirrorSelector();
-        Map<String, Map<String, String>> mirrors = m_config.getMirrors();
-
-        for (String mirrorName : mirrors.keySet()) {
-            Map<String, String> mirror = mirrors.get(mirrorName);
-            //The fields are id, url, mirrorOf, layout, mirrorOfLayouts.
-            String mirrorOf = mirror.get("mirrorOf");
-            String url = mirror.get("url");
-            // type can be null in this implementation (1.11)
-            selector.add(mirrorName, url, null, false, mirrorOf, "*");
-        }
-        return selector;
-        /**
-         Set<RemoteRepository> mirrorRepoList = new
HashSet<RemoteRepository>();
-         for (RemoteRepository r : m_remoteRepos) {
-         RemoteRepository mirrorRepo = mirrorSelector.getMirror(r);
-         if (mirrorRepo != null)
-         {
-         mirrorRepoList.add(mirrorRepo);
-         }
-         }
-         return mirrorRepoList;
-         **/
-    }
-
-    private List<RemoteRepository>
selectRepositories(List<MavenRepositoryURL> repos) {
-        List<RemoteRepository> list = new ArrayList<RemoteRepository>();
-        for (MavenRepositoryURL r : repos) {
-            list.add(new RemoteRepository(r.getId(), REPO_TYPE,
r.getURL().toExternalForm()));
-        }
-        return list;
-    }
-
-    public InputStream resolve(String groupId, String artifactId, String
classifier, String extension, String version) throws IOException {
-        // version = mapLatestToRange( version );
-        final RepositorySystemSession session = newSession();
-        Artifact artifact = new DefaultArtifact(groupId, artifactId,
classifier, extension, version);
-        File resolved = resolve(session, artifact);
-        return IO.read(resolved);
-    }
-
-    public VersionRangeResult resolveVersions(String groupId, String
artifactId, String classifier, String extension, String version) {
-        final RepositorySystemSession session = newSession();
-        Artifact artifact = new DefaultArtifact(groupId, artifactId,
classifier, extension, version);
-        if (artifact.getVersion().equals("LATEST")) {
-            artifact = artifact.setVersion(LATEST_VERSION_RANGE);
-        }
-        final VersionRangeRequest request = new
VersionRangeRequest(artifact, m_remoteRepos, null);
-        try {
-            return m_repoSystem.resolveVersionRange(session, request);
-        } catch (VersionRangeResolutionException e) {
-            final VersionRangeResult result = new
VersionRangeResult(request);
-            result.setVersions(Arrays.asList((Version) new
VersionImpl(version)));
-            return result;
-        }
-    }
-
-    private File resolve(RepositorySystemSession session, Artifact
artifact)
-            throws IOException {
-        try {
-            artifact = resolveLatestVersionRange(session, artifact);
-            artifact = m_repoSystem.resolveArtifact(session, new
ArtifactRequest(artifact, m_remoteRepos, null)).getArtifact();
-            if (artifact != null) {
-                final InstallRequest request = new InstallRequest();
-                request.addArtifact(artifact);
-                m_repoSystem.install(session, request);
-            }
-            return artifact.getFile();
-            } catch (RepositoryException e) {
-            throw new IOException("Aether Error.", e);
-        }
-    }
-
-    /**
-     * Tries to resolve versions = LATEST using an open range version
query.
-     * If it succeeds, version of artifact is set to the highest available
version.
-     *
-     * @param session  to be used.
-     * @param artifact to be used
-     * @return an artifact with version set properly (highest if available)
-     * @throws
org.sonatype.aether.resolution.VersionRangeResolutionException
-     *          in case of resolver errors.
-     */
-    private Artifact resolveLatestVersionRange(RepositorySystemSession
session, Artifact artifact)
-            throws VersionRangeResolutionException {
-        if (artifact.getVersion().equals("LATEST")) {
-            artifact = artifact.setVersion(LATEST_VERSION_RANGE);
-
-            VersionRangeResult versionResult =
m_repoSystem.resolveVersionRange(session, new VersionRangeRequest(artifact,
m_remoteRepos, null));
-            if (versionResult != null) {
-                Version v = versionResult.getHighestVersion();
-                if (v != null) {
-
-                    artifact = artifact.setVersion(v.toString());
-                } else {
-                    throw new
VersionRangeResolutionException(versionResult, "Not highest version found
for " + artifact);
-                }
-            }
-        }
-        return artifact;
-    }
-
-    private RepositorySystemSession newSession() {
-        assert m_config != null : "local repository cannot be null";
-        File local = m_config.getLocalRepository().getFile();
-
-        MavenRepositorySystemSession session = new
MavenRepositorySystemSession();
-
-        LocalRepository localRepo = new LocalRepository(local);
-
-
session.setLocalRepositoryManager(m_repoSystem.newLocalRepositoryManager(localRepo));
-        session.setMirrorSelector(m_mirrorSelector);
-        session.setProxySelector(m_proxySelector);
-        return session;
-    }
-
-    private Authentication getAuthentication(Map<String, String> proxy) {
-        // user, pass
-        if (proxy.containsKey("user")) {
-            return new Authentication(proxy.get("user"),
proxy.get("pass"));
-        }
-        return null;
-    }
-
-    private int toInt(String intStr) {
-        return Integer.parseInt(intStr);
-    }
-
-    private RepositorySystem newRepositorySystem() {
-        DefaultServiceLocator locator = new DefaultServiceLocator();
-
-        locator.addService(VersionResolver.class,
DefaultVersionResolver.class);
-        locator.addService(ArtifactDescriptorReader.class,
DefaultArtifactDescriptorReader.class);
-        locator.addService(VersionRangeResolver.class,
DefaultVersionRangeResolver.class);
-        locator.addService(MetadataResolver.class,
DefaultMetadataResolver.class);
-        locator.addService(ArtifactDescriptorReader.class,
DefaultArtifactDescriptorReader.class);
-        locator.addService(DependencyCollector.class,
DefaultDependencyCollector.class);
-        locator.addService(Installer.class, DefaultInstaller.class);
-        locator.addService(Deployer.class, DefaultDeployer.class);
-        locator.addService(SyncContextFactory.class,
DefaultSyncContextFactory.class);
-
-        locator.setServices(WagonProvider.class, new
ManualWagonProvider());
-        locator.addService(RepositoryConnectorFactory.class,
WagonRepositoryConnectorFactory.class);
-
-        locator.setService(LocalRepositoryManagerFactory.class,
SimpleLocalRepositoryManagerFactory.class);
-        locator.setService(Logger.class, NullLogger.class);
-
-        return locator.getService(RepositorySystem.class);
-    }
-
-    private static class VersionImpl implements Version {
-        private final String version;
-
-        private VersionImpl(String version) {
-            this.version = version;
-        }
-
-        @Override
-        public String toString() {
-            return version;
-        }
-
-        @Override
-        public int compareTo(final Version v) {
-            return 0;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/tomee/blob/c27dbf5d/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/ConfigHelper.java
----------------------------------------------------------------------
diff --git
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/ConfigHelper.java
b/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/ConfigHelper.java
deleted file mode 100644
index c162754..0000000
---
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/ConfigHelper.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.openejb.resolver.maven;
-
-import org.ops4j.pax.url.maven.commons.MavenConfigurationImpl;
-import org.ops4j.pax.url.maven.commons.MavenSettingsImpl;
-import org.ops4j.util.property.PropertiesPropertyResolver;
-
-public final class ConfigHelper {
-    private ConfigHelper() {
-        // no-op
-    }
-
-    public static MavenConfigurationImpl createConfig() {
-        final MavenConfigurationImpl config = new MavenConfigurationImpl(
-                new PropertiesPropertyResolver( System.getProperties() ),
"org.ops4j.pax.url.mvn");
-
-        config.setSettings( new MavenSettingsImpl(
config.getSettingsFileUrl(), config.useFallbackRepositories() ) );
-        return config;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tomee/blob/c27dbf5d/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/Connection.java
----------------------------------------------------------------------
diff --git
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/Connection.java
b/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/Connection.java
deleted file mode 100644
index 157db81..0000000
---
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/Connection.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.openejb.resolver.maven;
-
-import org.ops4j.pax.url.maven.commons.MavenConfigurationImpl;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-
-public class Connection extends URLConnection {
-    private Parser m_parser;
-    private AetherBasedResolver m_aetherBasedResolver;
-
-    public Connection( final URL url, final MavenConfigurationImpl
configuration ) throws MalformedURLException {
-        super(url);
-        m_parser = new Parser( url.getPath() );
-        m_aetherBasedResolver = new AetherBasedResolver( configuration,
m_parser.getRepositoryURL() );
-    }
-
-    @Override
-    public void connect() {
-        // no-op
-    }
-
-    @Override
-    public InputStream getInputStream() throws IOException {
-        connect();
-        return m_aetherBasedResolver.resolve( m_parser.getGroup(),
m_parser.getArtifact(), m_parser.getClassifier(), m_parser.getType(),
m_parser.getVersion() );
-    }
-}

http://git-wip-us.apache.org/repos/asf/tomee/blob/c27dbf5d/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/Handler.java
----------------------------------------------------------------------
diff --git
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/Handler.java
b/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/Handler.java
deleted file mode 100644
index fdc6d99..0000000
---
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/Handler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.openejb.resolver.maven;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-public class Handler extends URLStreamHandler  {
-    @Override
-    protected URLConnection openConnection( final URL url ) throws
IOException {
-        return new Connection( url, ConfigHelper.createConfig() );
-    }
-}

http://git-wip-us.apache.org/repos/asf/tomee/blob/c27dbf5d/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/ManualWagonProvider.java
----------------------------------------------------------------------
diff --git
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/ManualWagonProvider.java
b/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/ManualWagonProvider.java
deleted file mode 100644
index 02cf9f8..0000000
---
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/ManualWagonProvider.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.openejb.resolver.maven;
-
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.providers.file.FileWagon;
-import org.apache.maven.wagon.providers.http.HttpWagon;
-import org.sonatype.aether.connector.wagon.WagonProvider;
-
-public class ManualWagonProvider implements WagonProvider {
-    public Wagon lookup(String roleHint)
-            throws Exception {
-        if ("file".equals(roleHint)) {
-            return new FileWagon();
-        } else if (roleHint != null && roleHint.startsWith("http")) { //
http and https
-            return new HttpWagon();
-        }
-        return null;
-    }
-
-    public void release(Wagon wagon) {
-        // no-op
-    }
-}

http://git-wip-us.apache.org/repos/asf/tomee/blob/c27dbf5d/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/Parser.java
----------------------------------------------------------------------
diff --git
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/Parser.java
b/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/Parser.java
deleted file mode 100644
index f1585bb..0000000
---
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/Parser.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.openejb.resolver.maven;
-
-import org.ops4j.pax.url.maven.commons.MavenRepositoryURL;
-
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * This class respects both Maven Coordinates
- *
- *  - groupId:artifactId:packaging:classifier:version
- *  - http://maven.apache.org/pom.html#Maven_Coordinates
- *
- * And OPS4j coordinates
- *
- *  - groupId/artifactId/version/packaging/classifier
- *  - https://ops4j1.jira.com/wiki/display/paxurl/Mvn+Protocol
- *
- */
-public class Parser {
-    private static final String SYNTAX =
"mvn:[repository_url!]groupId/artifactId[/[version]/[type]]";
-    private static final String REPOSITORY_SEPARATOR = "!";
-    private static final String ARTIFACT_SEPARATOR = "/";
-    private static final String VERSION_SNAPSHOT = "SNAPSHOT";
-    private static final String FILE_SEPARATOR = "/";
-    private static final String GROUP_SEPARATOR = "\\.";
-    private static final String VERSION_SEPARATOR = "-";
-    private static final String TYPE_SEPARATOR = ".";
-    private static final String CLASSIFIER_SEPARATOR = "-";
-    private static final String METADATA_FILE = "maven-metadata.xml";
-    private static final String METADATA_FILE_LOCAL =
"maven-metadata-local.xml";
-
-    private final String group;
-    private final String artifact;
-    private final String version;
-    private final String type;
-    private final String classifier;
-    private final String fullClassifier;
-
-    private MavenRepositoryURL repositoryURL;
-
-    public Parser(final String rawPath) throws MalformedURLException {
-
-        if (rawPath == null) throw new MalformedURLException("Path cannot
be null. Syntax " + SYNTAX);
-
-        final boolean possibleMavenCoordinates = rawPath.contains(":");
-
-        final String path = rawPath.replace(":", "/"); // mvn:G:A:V =
mvn:G/A/V
-
-        if (path.startsWith(REPOSITORY_SEPARATOR) ||
path.endsWith(REPOSITORY_SEPARATOR)) {
-            throw new MalformedURLException("Path cannot start or end with
" + REPOSITORY_SEPARATOR + ". Syntax " + SYNTAX);
-        }
-
-        final String part;
-
-        if (path.contains(REPOSITORY_SEPARATOR)) {
-            int pos = path.lastIndexOf(REPOSITORY_SEPARATOR);
-            part = path.substring(pos + 1);
-            repositoryURL = new MavenRepositoryURL(path.substring(0, pos)
+ "@snapshots");
-        } else {
-            part = path;
-        }
-
-        final List<String> segments = new
ArrayList<String>(Arrays.asList(part.split(ARTIFACT_SEPARATOR)));
-
-        if (segments.size() < 2 || segments.size() > 5) {
-            throw new MalformedURLException("Invalid path. Syntax " +
SYNTAX);
-        }
-
-        // If Maven Coordinates were used, rearrange the segments to the
OPS4j format
-        if (possibleMavenCoordinates && segments.get(segments.size() -
1).matches("[0-9].*")) {
-            // position the version after the artifactId
-            final String version = segments.remove(segments.size() - 1);
-            segments.add(2, version);
-        }
-
-        final String[] coordinates = {null, null, "LATEST", "jar", null};
-
-        for (int i = 0; i < segments.size(); i++) {
-            final String value = segments.get(i).trim();
-            if (value.length() != 0) {
-                coordinates[i] = value;
-            }
-        }
-
-        this.group = coordinates[0];
-        this.artifact = coordinates[1];
-        this.version = coordinates[2];
-        this.type = coordinates[3];
-        this.classifier = coordinates[4];
-        this.fullClassifier = (this.classifier != null) ?
CLASSIFIER_SEPARATOR + classifier : null;
-
-        if (group == null) {
-            throw new MalformedURLException("Invalid groupId. Syntax " +
SYNTAX);
-        }
-
-        if (artifact == null) {
-            throw new MalformedURLException("Invalid artifactId. Syntax "
+ SYNTAX);
-        }
-    }
-
-    public String getGroup() {
-        return group;
-    }
-
-    public String getArtifact() {
-        return artifact;
-    }
-
-    public String getVersion() {
-        return version;
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public String getClassifier() {
-        return classifier;
-    }
-
-    public String getArtifactPath() {
-        return getArtifactPath(version);
-    }
-
-    public String getArtifactPath(final String version) {
-        return new StringBuilder()
-                .append(group.replaceAll(GROUP_SEPARATOR, FILE_SEPARATOR))
-                .append(FILE_SEPARATOR)
-                .append(artifact)
-                .append(FILE_SEPARATOR)
-                .append(version)
-                .append(FILE_SEPARATOR)
-                .append(artifact)
-                .append(VERSION_SEPARATOR)
-                .append(version)
-                .append(fullClassifier)
-                .append(TYPE_SEPARATOR)
-                .append(type)
-                .toString();
-    }
-
-    public String getSnapshotVersion(final String version, final String
timestamp, final String buildnumber) {
-        return version.replace(VERSION_SNAPSHOT, timestamp) +
VERSION_SEPARATOR + buildnumber;
-    }
-
-    public String getSnapshotPath(final String version, final String
timestamp, final String buildnumber) {
-        return new StringBuilder()
-                .append(group.replaceAll(GROUP_SEPARATOR, FILE_SEPARATOR))
-                .append(FILE_SEPARATOR)
-                .append(artifact)
-                .append(FILE_SEPARATOR)
-                .append(version)
-                .append(FILE_SEPARATOR)
-                .append(artifact)
-                .append(VERSION_SEPARATOR)
-                .append(getSnapshotVersion(version, timestamp,
buildnumber))
-                .append(fullClassifier)
-                .append(TYPE_SEPARATOR)
-                .append(type)
-                .toString();
-    }
-
-    public String getVersionMetadataPath(final String version) {
-        return new StringBuilder()
-                .append(group.replaceAll(GROUP_SEPARATOR, FILE_SEPARATOR))
-                .append(FILE_SEPARATOR)
-                .append(artifact)
-                .append(FILE_SEPARATOR)
-                .append(version)
-                .append(FILE_SEPARATOR)
-                .append(METADATA_FILE)
-                .toString();
-    }
-
-    public String getVersionLocalMetadataPath(final String version) {
-        return new StringBuilder()
-                .append(group.replaceAll(GROUP_SEPARATOR, FILE_SEPARATOR))
-                .append(FILE_SEPARATOR)
-                .append(artifact)
-                .append(FILE_SEPARATOR)
-                .append(version)
-                .append(FILE_SEPARATOR)
-                .append(METADATA_FILE_LOCAL)
-                .toString();
-    }
-
-    public String getArtifactLocalMetdataPath() {
-        return new StringBuilder()
-                .append(group.replaceAll(GROUP_SEPARATOR, FILE_SEPARATOR))
-                .append(FILE_SEPARATOR)
-                .append(artifact)
-                .append(FILE_SEPARATOR)
-                .append(METADATA_FILE_LOCAL)
-                .toString();
-    }
-
-    public String getArtifactMetdataPath() {
-        return new StringBuilder()
-                .append(group.replaceAll(GROUP_SEPARATOR, FILE_SEPARATOR))
-                .append(FILE_SEPARATOR)
-                .append(artifact)
-                .append(FILE_SEPARATOR)
-                .append(METADATA_FILE)
-                .toString();
-    }
-
-    public MavenRepositoryURL getRepositoryURL() {
-        return repositoryURL;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tomee/blob/c27dbf5d/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/ShrinkwrapBridge.java
----------------------------------------------------------------------
diff --git
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/ShrinkwrapBridge.java
b/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/ShrinkwrapBridge.java
new file mode 100644
index 0000000..9e98f56
--- /dev/null
+++
b/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/ShrinkwrapBridge.java
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.resolver.maven;
+
+import org.apache.openejb.util.reflection.Reflections;
+
+import java.io.File;
+
+public class ShrinkwrapBridge {
+    private static final Class<?>[] NO_PARAM = new Class[0];
+    private static final Class<?>[] STRING_PARAM = new
Class[]{String.class};
+    private static final Object[] NO_ARG = new Object[0];
+
+    public File resolve(final String rawLocation) throws Exception {
+        final Class<?> mvn =
Thread.currentThread().getContextClassLoader().loadClass("org.jboss.shrinkwrap.resolver.api.maven.Maven");
+        /*
+        return Maven.configureResolver().workOffline()
+            .resolve(toSwFormat(rawLocation))
+            .withoutTransitivity()
+            .asSingleFile()
+            .getAbsolutePath()
+         */
+        return File.class.cast(Reflections.invokeByReflection(
+            Reflections.invokeByReflection(
+                Reflections.invokeByReflection(
+                    Reflections.invokeByReflection(
+                        mvn.getMethod("configureResolver").invoke(null),
+                        "workOffline", NO_PARAM, NO_ARG),
+                    "resolve", STRING_PARAM, new
Object[]{toSwFormat(rawLocation)}),
+                "withoutTransitivity", NO_PARAM, NO_ARG),
+            "asSingleFile", NO_PARAM, NO_ARG));
+    }
+
+    private String toSwFormat(final String rawLocation) {
+        final String[] segments = rawLocation.split(":");
+        if (!"mvn".equals(segments[0])) {
+            throw new IllegalArgumentException("Only mvn prefix is
supported: " + rawLocation);
+        }
+
+        if (segments.length == 5) {
+            return segments[1] + ':' + segments[2] + ':' + segments[4] +
':' + segments[3];
+        } else if (segments.length == 4) {
+            return segments[1] + ':' + segments[2] + ':' + segments[3];
+        } else if (segments.length == 3) {
+            return segments[1] + ':' + segments[2];
+        }
+        throw new IllegalArgumentException("Unknown mvn format: " +
rawLocation);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/c27dbf5d/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/VersionResolver.java
----------------------------------------------------------------------
diff --git
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/VersionResolver.java
b/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/VersionResolver.java
deleted file mode 100644
index 868eada..0000000
---
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/VersionResolver.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.openejb.resolver.maven;
-
-import org.ops4j.pax.url.maven.commons.MavenConfigurationImpl;
-import org.sonatype.aether.resolution.VersionRangeResult;
-import org.sonatype.aether.version.Version;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Collections;
-import java.util.List;
-
-public final class VersionResolver {
-    private VersionResolver() {
-        // no-op
-    }
-
-    public static VersionRangeResult versions(final String info, final
String defaultVersion) {
-        final MavenConfigurationImpl config = ConfigHelper.createConfig();
-        try {
-            final Parser parser = new Parser(info);
-            final AetherBasedResolver resolver = new
AetherBasedResolver(config, parser.getRepositoryURL());
-            return resolver.resolveVersions(parser.getGroup(),
parser.getArtifact(), parser.getClassifier(), parser.getType(),
parser.getVersion());
-        } catch (MalformedURLException e) {
-            return null;
-        }
-    }
-
-    public static String highestVersion(final String info, final String
prefix, final String defaultVersion) {
-        final VersionRangeResult result = VersionResolver.versions(info,
defaultVersion);
-        if (result == null) {
-            return defaultVersion;
-        }
-        final List<Version> versions = result.getVersions();
-        Collections.sort(versions); // Version impl comparable so we just
need to call it :)
-        Version usedVersion = null;
-        for (Version current : versions) {
-            if (current.toString().startsWith(prefix)) {
-                usedVersion = current;
-            }
-        }
-        if (usedVersion != null) {
-            return usedVersion.toString();
-        }
-        return defaultVersion;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tomee/blob/c27dbf5d/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/package-info.java
----------------------------------------------------------------------
diff --git
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/package-info.java
b/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/package-info.java
deleted file mode 100644
index 4a7a6c1..0000000
---
a/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/maven/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// mainly copied from pax-url-aether
-package org.apache.openejb.resolver.maven;

http://git-wip-us.apache.org/repos/asf/tomee/blob/c27dbf5d/utils/openejb-provisionning/src/test/java/org/apache/openejb/resolver/maven/ParserTest.java
----------------------------------------------------------------------
diff --git
a/utils/openejb-provisionning/src/test/java/org/apache/openejb/resolver/maven/ParserTest.java
b/utils/openejb-provisionning/src/test/java/org/apache/openejb/resolver/maven/ParserTest.java
deleted file mode 100644
index bee7a8a..0000000
---
a/utils/openejb-provisionning/src/test/java/org/apache/openejb/resolver/maven/ParserTest.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.openejb.resolver.maven;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.net.MalformedURLException;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ParserTest {
-
-
-    @Test
-    public void testPaxURLs() throws Exception {
-
-        final String groupId = "orange";
-        final String artifactId = "yellow";
-        final String version = "1.0-SNAPSHOT";
-        final String classifier = "square";
-        final String type = "zip";
-
-        {
-            final Parser parser = new Parser(String.format("%s/%s",
groupId, artifactId));
-
-            assertEquals(groupId, parser.getGroup());
-            assertEquals(artifactId, parser.getArtifact());
-            assertEquals("LATEST", parser.getVersion());
-            assertEquals("jar", parser.getType());
-            assertEquals(null, parser.getClassifier());
-        }
-
-        {
-            final Parser parser = new Parser(String.format("%s/%s/%s",
groupId, artifactId, version));
-
-            assertEquals(groupId, parser.getGroup());
-            assertEquals(artifactId, parser.getArtifact());
-            assertEquals(version, parser.getVersion());
-            assertEquals("jar", parser.getType());
-            assertEquals(null, parser.getClassifier());
-        }
-
-        {
-            final Parser parser = new Parser(String.format("%s/%s/%s/%s",
groupId, artifactId, version, type));
-
-            assertEquals(groupId, parser.getGroup());
-            assertEquals(artifactId, parser.getArtifact());
-            assertEquals(version, parser.getVersion());
-            assertEquals(type, parser.getType());
-            assertEquals(null, parser.getClassifier());
-        }
-
-        {
-            final Parser parser = new
Parser(String.format("%s/%s/%s/%s/%s", groupId, artifactId, version, type,
classifier));
-
-            assertEquals(groupId, parser.getGroup());
-            assertEquals(artifactId, parser.getArtifact());
-            assertEquals(version, parser.getVersion());
-            assertEquals(type, parser.getType());
-            assertEquals(classifier, parser.getClassifier());
-        }
-
-        { // no version
-            final Parser parser = new Parser(String.format("%s/%s//%s/%s",
groupId, artifactId, type, classifier));
-
-            assertEquals(groupId, parser.getGroup());
-            assertEquals(artifactId, parser.getArtifact());
-            assertEquals("LATEST", parser.getVersion());
-            assertEquals(type, parser.getType());
-            assertEquals(classifier, parser.getClassifier());
-        }
-
-        { // no type
-            final Parser parser = new Parser(String.format("%s/%s/%s//%s",
groupId, artifactId, version, classifier));
-
-            assertEquals(groupId, parser.getGroup());
-            assertEquals(artifactId, parser.getArtifact());
-            assertEquals(version, parser.getVersion());
-            assertEquals("jar", parser.getType());
-            assertEquals(classifier, parser.getClassifier());
-        }
-
-        { // no classifier
-            final Parser parser = new Parser(String.format("%s/%s/%s/%s/",
groupId, artifactId, version, type));
-
-            assertEquals(groupId, parser.getGroup());
-            assertEquals(artifactId, parser.getArtifact());
-            assertEquals(version, parser.getVersion());
-            assertEquals(type, parser.getType());
-            assertEquals(null, parser.getClassifier());
-        }
-
-        { // no version or type
-            final Parser parser = new Parser(String.format("%s/%s///%s",
groupId, artifactId, classifier));
-
-            assertEquals(groupId, parser.getGroup());
-            assertEquals(artifactId, parser.getArtifact());
-            assertEquals("LATEST", parser.getVersion());
-            assertEquals("jar", parser.getType());
-            assertEquals(classifier, parser.getClassifier());
-        }
-
-        { //  no version or type or classifier
-            final Parser parser = new Parser(String.format("%s/%s///",
groupId, artifactId));
-
-            assertEquals(groupId, parser.getGroup());
-            assertEquals(artifactId, parser.getArtifact());
-            assertEquals("LATEST", parser.getVersion());
-            assertEquals("jar", parser.getType());
-            assertEquals(null, parser.getClassifier());
-        }
-
-
-        try { //  no group
-            new Parser(String.format("/%s///", artifactId));
-
-            Assert.fail("Expected MalformedURLException");
-        } catch (MalformedURLException pass) {
-        }
-
-        try { //  no artifact
-            new Parser(String.format("%s////", groupId));
-
-            Assert.fail("Expected MalformedURLException");
-        } catch (MalformedURLException pass) {
-        }
-
-        try { //  no artifact
-            new Parser(String.format("%s//%s", groupId, version));
-
-            Assert.fail("Expected MalformedURLException");
-        } catch (MalformedURLException pass) {
-        }
-
-        try { //  too long
-            final Parser parser = new
Parser(String.format("%s/%s/%s/%s/%s/%s", groupId, artifactId, version,
type, classifier, classifier));
-
-            Assert.fail("Expected MalformedURLException");
-        } catch (MalformedURLException pass) {
-        }
-    }
-
-
-
-    @Test
-    public void testMavenCoordinates() throws Exception {
-
-        final String groupId = "orange";
-        final String artifactId = "yellow";
-        final String version = "1.0-SNAPSHOT";
-        final String classifier = "square";
-        final String type = "zip";
-
-        {
-            final Parser parser = new Parser(String.format("%s:%s",
groupId, artifactId));
-
-            assertEquals(groupId, parser.getGroup());
-            assertEquals(artifactId, parser.getArtifact());
-            assertEquals("LATEST", parser.getVersion());
-            assertEquals("jar", parser.getType());
-            assertEquals(null, parser.getClassifier());
-        }
-
-        {
-            final Parser parser = new Parser(String.format("%s:%s:%s",
groupId, artifactId, version));
-
-            assertEquals(groupId, parser.getGroup());
-            assertEquals(artifactId, parser.getArtifact());
-            assertEquals(version, parser.getVersion());
-            assertEquals("jar", parser.getType());
-            assertEquals(null, parser.getClassifier());
-        }
-
-        {
-            final Parser parser = new Parser(String.format("%s:%s:%s:%s",
groupId, artifactId, type, version));
-
-            assertEquals(groupId, parser.getGroup());
-            assertEquals(artifactId, parser.getArtifact());
-            assertEquals(version, parser.getVersion());
-            assertEquals(type, parser.getType());
-            assertEquals(null, parser.getClassifier());
-        }
-
-        {
-            final Parser parser = new
Parser(String.format("%s:%s:%s:%s:%s", groupId, artifactId, type,
classifier, version));
-
-            assertEquals(groupId, parser.getGroup());
-            assertEquals(artifactId, parser.getArtifact());
-            assertEquals(version, parser.getVersion());
-            assertEquals(type, parser.getType());
-            assertEquals(classifier, parser.getClassifier());
-        }
-
-        try { //  no group
-            new Parser(String.format(":%s:::", artifactId));
-
-            Assert.fail("Expected MalformedURLException");
-        } catch (MalformedURLException pass) {
-        }
-
-        try { //  no artifact
-            new Parser(String.format("%s::::", groupId));
-
-            Assert.fail("Expected MalformedURLException");
-        } catch (MalformedURLException pass) {
-        }
-
-        try { //  no artifact
-            new Parser(String.format("%s::%s", groupId, version));
-
-            Assert.fail("Expected MalformedURLException");
-        } catch (MalformedURLException pass) {
-        }
-
-        try { //  too long
-            final Parser parser = new
Parser(String.format("%s:%s:%s:%s:%s:%s", groupId, artifactId, version,
type, classifier, classifier));
-
-            Assert.fail("Expected MalformedURLException");
-        } catch (MalformedURLException pass) {
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/tomee/blob/c27dbf5d/utils/openejb-provisionning/src/test/java/org/apache/openejb/resolver/maven/SWMvnResolverTest.java
----------------------------------------------------------------------
diff --git
a/utils/openejb-provisionning/src/test/java/org/apache/openejb/resolver/maven/SWMvnResolverTest.java
b/utils/openejb-provisionning/src/test/java/org/apache/openejb/resolver/maven/SWMvnResolverTest.java
new file mode 100644
index 0000000..66c0eaa
--- /dev/null
+++
b/utils/openejb-provisionning/src/test/java/org/apache/openejb/resolver/maven/SWMvnResolverTest.java
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.resolver.maven;
+
+import org.apache.openejb.resolver.Resolver;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class SWMvnResolverTest {
+    @Test
+    public void resolve() throws IOException {
+        // something we have in the build to not depend on the net
connection
+        try (final InputStream resolve = new
Resolver().resolve("mvn:junit:junit:4.12")) {
+            assertNotNull(resolve);
+            assertTrue(resolve.read() > -1); // something to read = a real
file
+        }
+    }
+}