diff --git a/pom.xml b/pom.xml
index 8c48569..5d07039 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
io.airlift
airbase
- 80
+ 134
io.airlift.resolver
@@ -23,8 +23,8 @@
- 1.13.1
- 3.0.4
+ 1.9.6
+ 3.8.7
true
@@ -43,63 +43,52 @@
- org.sonatype.aether
- aether-spi
+ org.apache.maven.resolver
+ maven-resolver-spi
${dep.aether.version}
- org.sonatype.aether
- aether-api
+ org.apache.maven.resolver
+ maven-resolver-api
${dep.aether.version}
- org.sonatype.aether
- aether-impl
+ org.apache.maven.resolver
+ maven-resolver-impl
${dep.aether.version}
- org.sonatype.aether
- aether-util
+ org.apache.maven.resolver
+ maven-resolver-util
${dep.aether.version}
- org.sonatype.aether
- aether-connector-file
+ org.apache.maven.resolver
+ maven-resolver-connector-basic
${dep.aether.version}
- org.sonatype.aether
- aether-connector-asynchttpclient
+ org.apache.maven.resolver
+ maven-resolver-transport-file
${dep.aether.version}
-
-
- org.jboss.netty
- netty
-
-
- io.netty
- netty
- 3.6.2.Final
+ org.apache.maven.resolver
+ maven-resolver-transport-http
+ ${dep.aether.version}
+
- org.apache.maven
- maven-core
- ${dep.maven.version}
-
-
- org.sonatype.sisu
- sisu-inject-plexus
-
-
+ commons-codec
+ commons-codec
+ 1.15
@@ -116,54 +105,76 @@
org.apache.maven
- maven-aether-provider
+ maven-resolver-provider
${dep.maven.version}
org.apache.maven
- maven-embedder
+ maven-core
${dep.maven.version}
-
-
- org.sonatype.sisu
- sisu-inject-plexus
-
-
- commons-cli
- commons-cli
-
-
+
+
+
+
+ org.apache.maven
+ maven-compat
+ ${dep.maven.version}
+ runtime
org.codehaus.plexus
- plexus-container-default
- 1.5.5
+ plexus-utils
+ 3.5.1
+
+
+
+
+ javax.inject
+ javax.inject
+ 1
+
+
+ org.eclipse.sisu
+ org.eclipse.sisu.inject
+ 0.3.5
+ runtime
+
+
+
+ org.codehaus.plexus
+ plexus-classworlds
+ 2.6.0
+
+
+
+ org.eclipse.sisu
+ org.eclipse.sisu.plexus
+ 0.3.5
+
+
+ com.google.inject
+ guice
+ 4.2.3
+ runtime
+
+
+ com.google.guava
+ guava
+ 31.1-jre
- commons-logging
- commons-logging-api
-
-
- com.google.collections
- google-collections
-
-
- junit
- junit
-
-
- log4j
- log4j
+ com.google.guava
+ listenablefuture
-
- org.codehaus.plexus
- plexus-classworlds
- 2.4
+ com.google.guava
+ failureaccess
+ 1.0.1
+ runtime
diff --git a/resolver-integration/pom.xml b/resolver-integration/pom.xml
index a4b4782..59464c1 100644
--- a/resolver-integration/pom.xml
+++ b/resolver-integration/pom.xml
@@ -30,8 +30,8 @@
- org.sonatype.aether
- aether-api
+ org.apache.maven.resolver
+ maven-resolver-api
test
diff --git a/resolver-integration/src/test/java/io/airlift/resolver/TestArtifactResolve.java b/resolver-integration/src/test/java/io/airlift/resolver/TestArtifactResolve.java
index 42cea0a..84721d5 100644
--- a/resolver-integration/src/test/java/io/airlift/resolver/TestArtifactResolve.java
+++ b/resolver-integration/src/test/java/io/airlift/resolver/TestArtifactResolve.java
@@ -13,7 +13,8 @@
*/
package io.airlift.resolver;
-import org.sonatype.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
import org.testng.Assert;
import org.testng.annotations.Test;
diff --git a/resolver/pom.xml b/resolver/pom.xml
index 248c347..f321641 100644
--- a/resolver/pom.xml
+++ b/resolver/pom.xml
@@ -16,44 +16,38 @@
- org.sonatype.aether
- aether-spi
+ org.apache.maven.resolver
+ maven-resolver-spi
- org.sonatype.aether
- aether-api
+ org.apache.maven.resolver
+ maven-resolver-api
- org.sonatype.aether
- aether-impl
+ org.apache.maven.resolver
+ maven-resolver-impl
- org.sonatype.aether
- aether-util
+ org.apache.maven.resolver
+ maven-resolver-util
- org.sonatype.aether
- aether-connector-file
+ org.apache.maven.resolver
+ maven-resolver-connector-basic
- org.sonatype.aether
- aether-connector-asynchttpclient
+ org.apache.maven.resolver
+ maven-resolver-transport-file
- io.netty
- netty
- runtime
-
-
-
- org.apache.maven
- maven-core
+ org.apache.maven.resolver
+ maven-resolver-transport-http
@@ -68,18 +62,17 @@
org.apache.maven
- maven-aether-provider
+ maven-resolver-provider
org.apache.maven
- maven-embedder
- runtime
+ maven-core
- org.codehaus.plexus
- plexus-container-default
+ org.apache.maven
+ maven-compat
@@ -88,9 +81,8 @@
- com.google.inject
- guice
- runtime
+ org.eclipse.sisu
+ org.eclipse.sisu.plexus
diff --git a/resolver/src/main/java/io/airlift/resolver/ArtifactResolver.java b/resolver/src/main/java/io/airlift/resolver/ArtifactResolver.java
index b21e431..4e1868c 100644
--- a/resolver/src/main/java/io/airlift/resolver/ArtifactResolver.java
+++ b/resolver/src/main/java/io/airlift/resolver/ArtifactResolver.java
@@ -17,40 +17,42 @@
import com.google.common.collect.ImmutableSet;
import io.airlift.resolver.internal.ConsoleRepositoryListener;
import io.airlift.resolver.internal.ConsoleTransferListener;
-import io.airlift.resolver.internal.Slf4jLoggerManager;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.project.DefaultProjectBuildingRequest;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuilder;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.project.ProjectBuildingResult;
-import org.apache.maven.repository.internal.MavenRepositorySystemSession;
-import org.apache.maven.repository.internal.MavenServiceLocator;
+import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
+import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.PlexusContainerException;
import org.codehaus.plexus.classworlds.ClassWorld;
import org.codehaus.plexus.logging.Logger;
-import org.sonatype.aether.RepositorySystem;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.collection.CollectRequest;
-import org.sonatype.aether.connector.async.AsyncRepositoryConnectorFactory;
-import org.sonatype.aether.connector.file.FileRepositoryConnectorFactory;
-import org.sonatype.aether.graph.Dependency;
-import org.sonatype.aether.graph.Exclusion;
-import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
-import org.sonatype.aether.repository.LocalRepositoryManager;
-import org.sonatype.aether.repository.RemoteRepository;
-import org.sonatype.aether.resolution.ArtifactResult;
-import org.sonatype.aether.resolution.DependencyRequest;
-import org.sonatype.aether.resolution.DependencyResolutionException;
-import org.sonatype.aether.resolution.DependencyResult;
-import org.sonatype.aether.spi.connector.RepositoryConnectorFactory;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
-import org.sonatype.aether.util.artifact.JavaScopes;
-import org.sonatype.aether.util.filter.DependencyFilterUtils;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.collection.CollectRequest;
+import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
+import org.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.Exclusion;
+import org.eclipse.aether.impl.DefaultServiceLocator;
+import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.resolution.ArtifactResult;
+import org.eclipse.aether.resolution.DependencyRequest;
+import org.eclipse.aether.resolution.DependencyResolutionException;
+import org.eclipse.aether.resolution.DependencyResult;
+import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
+import org.eclipse.aether.spi.connector.transport.TransporterFactory;
+import org.eclipse.aether.transport.file.FileTransporterFactory;
+import org.eclipse.aether.transport.http.HttpTransporterFactory;
+import org.eclipse.aether.util.artifact.JavaScopes;
+import org.eclipse.aether.util.filter.DependencyFilterUtils;
import java.io.File;
import java.util.ArrayList;
@@ -79,7 +81,7 @@ public class ArtifactResolver
.build();
private final RepositorySystem repositorySystem;
- private final MavenRepositorySystemSession repositorySystemSession;
+ private final DefaultRepositorySystemSession repositorySystemSession;
private final List repositories;
public ArtifactResolver(String localRepositoryDir, String... remoteRepositoryUris)
@@ -89,15 +91,16 @@ public ArtifactResolver(String localRepositoryDir, String... remoteRepositoryUri
public ArtifactResolver(String localRepositoryDir, List remoteRepositoryUris)
{
- MavenServiceLocator locator = new MavenServiceLocator();
- locator.addService(RepositoryConnectorFactory.class, FileRepositoryConnectorFactory.class);
- locator.addService(RepositoryConnectorFactory.class, AsyncRepositoryConnectorFactory.class);
+ // TODO: move off deprecated ServiceLocator, use Sisu instead
+ DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
+ locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
+ locator.addService( TransporterFactory.class, FileTransporterFactory.class);
+ locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
repositorySystem = locator.getService(RepositorySystem.class);
- repositorySystemSession = new MavenRepositorySystemSession();
-
- LocalRepositoryManager localRepositoryManager = new SimpleLocalRepositoryManager(localRepositoryDir);
- repositorySystemSession.setLocalRepositoryManager(localRepositoryManager);
+ repositorySystemSession = MavenRepositorySystemUtils.newSession();
+ LocalRepository localRepo = new LocalRepository(localRepositoryDir);
+ repositorySystemSession.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManager(repositorySystemSession, localRepo));
repositorySystemSession.setTransferListener(new ConsoleTransferListener());
repositorySystemSession.setRepositoryListener(new ConsoleRepositoryListener());
@@ -105,7 +108,7 @@ public ArtifactResolver(String localRepositoryDir, List remoteRepository
List repositories = new ArrayList<>(remoteRepositoryUris.size());
int index = 0;
for (String repositoryUri : remoteRepositoryUris) {
- repositories.add(new RemoteRepository("repo-" + index++, "default", repositoryUri));
+ repositories.add(new RemoteRepository.Builder("repo-" + index++, "default", repositoryUri ).build() );
}
this.repositories = Collections.unmodifiableList(repositories);
}
@@ -124,7 +127,7 @@ public List resolveArtifacts(Iterable extends Artifact> sourceArtifa
for (RemoteRepository repository : repositories) {
// Hack: avoid using deprecated Maven Central URLs
if (DEPRECATED_MAVEN_CENTRAL_URIS.contains(repository.getUrl())) {
- repository = new RemoteRepository(repository.getId(), repository.getContentType(), MAVEN_CENTRAL_URI);
+ repository = new RemoteRepository.Builder(repository.getId(), repository.getContentType(), MAVEN_CENTRAL_URI).build();
}
collectRequest.addRepository(repository);
}
@@ -153,13 +156,13 @@ public List resolvePom(File pomFile)
ImmutableList.Builder allRepositories = ImmutableList.builder();
for (RemoteRepository repository : pom.getRemoteProjectRepositories()) {
if (DEPRECATED_MAVEN_CENTRAL_URIS.contains(repository.getUrl())) {
- repository = new RemoteRepository(repository.getId(), repository.getContentType(), MAVEN_CENTRAL_URI);
+ repository = new RemoteRepository.Builder(repository.getId(), repository.getContentType(), MAVEN_CENTRAL_URI).build();
}
allRepositories.add(repository);
}
for (RemoteRepository repository : repositories) {
if (DEPRECATED_MAVEN_CENTRAL_URIS.contains(repository.getUrl())) {
- repository = new RemoteRepository(repository.getId(), repository.getContentType(), MAVEN_CENTRAL_URI);
+ repository = new RemoteRepository.Builder(repository.getId(), repository.getContentType(), MAVEN_CENTRAL_URI).build();
}
allRepositories.add(repository);
}
@@ -187,6 +190,7 @@ public List resolvePom(File pomFile)
private MavenProject getMavenProject(File pomFile)
{
+ // TODO: move off deprecated org.apache.maven.repository.RepositorySystem (impl is in maven2 compat module)
try {
PlexusContainer container = container();
org.apache.maven.repository.RepositorySystem lrs = container.lookup(org.apache.maven.repository.RepositorySystem.class);
@@ -285,12 +289,15 @@ private List resolveArtifacts(DependencyRequest dependencyRequest)
private static PlexusContainer container()
{
+ // TODO: move off Plexus DI, use Sisu instead
try {
ClassWorld classWorld = new ClassWorld("plexus.core", Thread.currentThread().getContextClassLoader());
ContainerConfiguration cc = new DefaultContainerConfiguration()
.setClassWorld(classWorld)
.setRealm(null)
+ .setAutoWiring(true)
+ .setClassPathScanning(PlexusConstants.SCANNING_CACHE)
.setName("maven");
DefaultPlexusContainer container = new DefaultPlexusContainer(cc);
@@ -298,7 +305,7 @@ private static PlexusContainer container()
// NOTE: To avoid inconsistencies, we'll use the Thread context class loader exclusively for lookups
container.setLookupRealm(null);
- container.setLoggerManager(new Slf4jLoggerManager());
+ //container.setLoggerManager(new Slf4jLoggerManager());
container.getLoggerManager().setThresholds(Logger.LEVEL_INFO);
return container;
diff --git a/resolver/src/main/java/io/airlift/resolver/DefaultArtifact.java b/resolver/src/main/java/io/airlift/resolver/DefaultArtifact.java
deleted file mode 100644
index 7a11091..0000000
--- a/resolver/src/main/java/io/airlift/resolver/DefaultArtifact.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Licensed 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 io.airlift.resolver;
-
-/*******************************************************************************
- * Copyright (c) 2010-2011 Sonatype, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.artifact.ArtifactType;
-
-import java.io.File;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * A simple artifact. Note: Instances of this class are immutable and the exposed mutators return new objects
- * rather than changing the current instance.
- *
- * @author Benjamin Bentmann
- */
-public final class DefaultArtifact
- implements Artifact
-{
- private static final String SNAPSHOT = "SNAPSHOT";
- private static final Pattern SNAPSHOT_TIMESTAMP = Pattern.compile("^(.*-)?([0-9]{8}.[0-9]{6}-[0-9]+)$");
-
- private final String groupId;
- private final String artifactId;
- private final String version;
- private final String classifier;
- private final String extension;
- private final File file;
- private final Map properties;
- private String baseVersion;
-
- /**
- * Creates a new artifact with the specified coordinates. If not specified in the artifact coordinates, the
- * artifact's extension defaults to {@code jar} and classifier to an empty string.
- *
- * @param coords The artifact coordinates in the format
- * {@code :[:[:]]:}, must not be {@code null}.
- */
- public DefaultArtifact(String coords)
- {
- this(coords, Collections.emptyMap());
- }
-
- /**
- * Creates a new artifact with the specified coordinates and properties. If not specified in the artifact
- * coordinates, the artifact's extension defaults to {@code jar} and classifier to an empty string.
- *
- * @param coords The artifact coordinates in the format
- * {@code :[:[:]]:}, must not be {@code null}.
- * @param properties The artifact properties, may be {@code null}.
- */
- public DefaultArtifact(String coords, Map properties)
- {
- Pattern p = Pattern.compile("([^: ]+):([^: ]+)(:([^: ]*)(:([^: ]+))?)?:([^: ]+)");
- Matcher m = p.matcher(coords);
- if (!m.matches()) {
- throw new IllegalArgumentException("Bad artifact coordinates " + coords
- + ", expected format is :[:[:]]:");
- }
- this.groupId = m.group(1);
- this.artifactId = m.group(2);
- this.extension = get(m.group(4), "jar");
- this.classifier = get(m.group(6), "");
- this.version = m.group(7);
- this.file = null;
- this.properties = Collections.unmodifiableMap(new LinkedHashMap<>(properties));
- }
-
- private static String get(String value, String defaultValue)
- {
- return (value == null || value.length() <= 0) ? defaultValue : value;
- }
-
- /**
- * Creates a new artifact with the specified coordinates and no classifier. Passing {@code null} for any of the
- * coordinates is equivalent to specifying an empty string.
- *
- * @param groupId The group identifier of the artifact, may be {@code null}.
- * @param artifactId The artifact identifier of the artifact, may be {@code null}.
- * @param extension The file extension of the artifact, may be {@code null}.
- * @param version The version of the artifact, may be {@code null}.
- */
- public DefaultArtifact(String groupId, String artifactId, String extension, String version)
- {
- this(groupId, artifactId, "", extension, version);
- }
-
- /**
- * Creates a new artifact with the specified coordinates. Passing {@code null} for any of the coordinates is
- * equivalent to specifying an empty string.
- *
- * @param groupId The group identifier of the artifact, may be {@code null}.
- * @param artifactId The artifact identifier of the artifact, may be {@code null}.
- * @param classifier The classifier of the artifact, may be {@code null}.
- * @param extension The file extension of the artifact, may be {@code null}.
- * @param version The version of the artifact, may be {@code null}.
- */
- public DefaultArtifact(String groupId, String artifactId, String classifier, String extension, String version)
- {
- this(groupId, artifactId, classifier, extension, version, null, (File) null);
- }
-
- /**
- * Creates a new artifact with the specified coordinates. Passing {@code null} for any of the coordinates is
- * equivalent to specifying an empty string. The optional artifact type provided to this constructor will be used to
- * determine the artifact's classifier and file extension if the corresponding arguments for this constructor are
- * {@code null}.
- *
- * @param groupId The group identifier of the artifact, may be {@code null}.
- * @param artifactId The artifact identifier of the artifact, may be {@code null}.
- * @param classifier The classifier of the artifact, may be {@code null}.
- * @param extension The file extension of the artifact, may be {@code null}.
- * @param version The version of the artifact, may be {@code null}.
- * @param type The artifact type from which to query classifier, file extension and properties, may be {@code null}.
- */
- public DefaultArtifact(String groupId, String artifactId, String classifier, String extension, String version,
- ArtifactType type)
- {
- this(groupId, artifactId, classifier, extension, version, null, type);
- }
-
- /**
- * Creates a new artifact with the specified coordinates and properties. Passing {@code null} for any of the
- * coordinates is equivalent to specifying an empty string. The optional artifact type provided to this constructor
- * will be used to determine the artifact's classifier and file extension if the corresponding arguments for this
- * constructor are {@code null}. If the artifact type specifies properties, those will get merged with the
- * properties passed directly into the constructor, with the latter properties taking precedence.
- *
- * @param groupId The group identifier of the artifact, may be {@code null}.
- * @param artifactId The artifact identifier of the artifact, may be {@code null}.
- * @param classifier The classifier of the artifact, may be {@code null}.
- * @param extension The file extension of the artifact, may be {@code null}.
- * @param version The version of the artifact, may be {@code null}.
- * @param properties The properties of the artifact, may be {@code null} if none.
- * @param type The artifact type from which to query classifier, file extension and properties, may be {@code null}.
- */
- public DefaultArtifact(String groupId, String artifactId, String classifier, String extension, String version,
- Map properties, ArtifactType type)
- {
- this.groupId = emptify(groupId);
- this.artifactId = emptify(artifactId);
- if (classifier != null || type == null) {
- this.classifier = emptify(classifier);
- }
- else {
- this.classifier = emptify(type.getClassifier());
- }
- if (extension != null || type == null) {
- this.extension = emptify(extension);
- }
- else {
- this.extension = emptify(type.getExtension());
- }
- this.version = emptify(version);
- this.file = null;
- this.properties = merge(properties, (type != null) ? type.getProperties() : null);
- }
-
- private static Map merge(Map dominant, Map recessive)
- {
- Map properties;
-
- if ((dominant == null || dominant.isEmpty()) && (recessive == null || recessive.isEmpty())) {
- properties = Collections.emptyMap();
- }
- else {
- properties = new HashMap<>();
- if (recessive != null) {
- properties.putAll(recessive);
- }
- if (dominant != null) {
- properties.putAll(dominant);
- }
- }
-
- return properties;
- }
-
- /**
- * Creates a new artifact with the specified coordinates, properties and file. Passing {@code null} for any of the
- * coordinates is equivalent to specifying an empty string.
- *
- * @param groupId The group identifier of the artifact, may be {@code null}.
- * @param artifactId The artifact identifier of the artifact, may be {@code null}.
- * @param classifier The classifier of the artifact, may be {@code null}.
- * @param extension The file extension of the artifact, may be {@code null}.
- * @param version The version of the artifact, may be {@code null}.
- * @param properties The properties of the artifact, may be {@code null} if none.
- * @param file The resolved file of the artifact, may be {@code null}.
- */
- public DefaultArtifact(String groupId, String artifactId, String classifier, String extension, String version,
- Map properties, File file)
- {
- this.groupId = emptify(groupId);
- this.artifactId = emptify(artifactId);
- this.classifier = emptify(classifier);
- this.extension = emptify(extension);
- this.version = emptify(version);
- this.file = file;
- this.properties = Collections.unmodifiableMap(new LinkedHashMap<>(properties));
- }
-
- DefaultArtifact(String groupId, String artifactId, String classifier, String extension, String version, File file,
- Map properties)
- {
- // NOTE: This constructor assumes immutability of the provided properties, for internal use only
- this.groupId = emptify(groupId);
- this.artifactId = emptify(artifactId);
- this.classifier = emptify(classifier);
- this.extension = emptify(extension);
- this.version = emptify(version);
- this.file = file;
- this.properties = properties;
- }
-
- private static String emptify(String str)
- {
- return (str == null) ? "" : str;
- }
-
- @Override
- public String getGroupId()
- {
- return groupId;
- }
-
- @Override
- public String getArtifactId()
- {
- return artifactId;
- }
-
- @Override
- public String getBaseVersion()
- {
- if (baseVersion == null) {
- baseVersion = toBaseVersion(getVersion());
- }
- return baseVersion;
- }
-
- @Override
- public String getVersion()
- {
- return version;
- }
-
- @Override
- public Artifact setVersion(String version)
- {
- if (this.version.equals(version) || (version == null && this.version.length() <= 0)) {
- return this;
- }
- return new DefaultArtifact(groupId, artifactId, classifier, extension, version, file, properties);
- }
-
- @Override
- public boolean isSnapshot()
- {
- return version.endsWith(SNAPSHOT) || SNAPSHOT_TIMESTAMP.matcher(version).matches();
- }
-
- @Override
- public String getClassifier()
- {
- return classifier;
- }
-
- @Override
- public String getExtension()
- {
- return extension;
- }
-
- @Override
- public File getFile()
- {
- return file;
- }
-
- @Override
- public Artifact setFile(File file)
- {
- if ((this.file == null) ? file == null : this.file.equals(file)) {
- return this;
- }
- return new DefaultArtifact(groupId, artifactId, classifier, extension, version, file, properties);
- }
-
- @Override
- public String getProperty(String key, String defaultValue)
- {
- String value = properties.get(key);
- return (value != null) ? value : defaultValue;
- }
-
- @Override
- public Map getProperties()
- {
- return Collections.unmodifiableMap(properties);
- }
-
- @Override
- public Artifact setProperties(Map properties)
- {
- if (this.properties.equals(properties) || (properties == null && this.properties.isEmpty())) {
- return this;
- }
- return new DefaultArtifact(groupId, artifactId, classifier, extension, version, file, Collections.unmodifiableMap(new LinkedHashMap<>(properties)));
- }
-
- protected static String toBaseVersion(String version)
- {
- if (version == null) {
- return version;
- }
-
- if (version.startsWith("[") || version.startsWith("(")) {
- return version;
- }
-
- Matcher m = SNAPSHOT_TIMESTAMP.matcher(version);
- if (!m.matches()) {
- return version;
- }
-
- if (m.group(1) == null) {
- return SNAPSHOT;
- }
-
- return m.group(1) + SNAPSHOT;
- }
-}
diff --git a/resolver/src/main/java/io/airlift/resolver/Main.java b/resolver/src/main/java/io/airlift/resolver/Main.java
index fe53281..ad9e01b 100644
--- a/resolver/src/main/java/io/airlift/resolver/Main.java
+++ b/resolver/src/main/java/io/airlift/resolver/Main.java
@@ -13,7 +13,8 @@
*/
package io.airlift.resolver;
-import org.sonatype.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
import java.io.File;
import java.util.ArrayList;
diff --git a/resolver/src/main/java/io/airlift/resolver/internal/ConsoleRepositoryListener.java b/resolver/src/main/java/io/airlift/resolver/internal/ConsoleRepositoryListener.java
index 13e39cc..0123554 100644
--- a/resolver/src/main/java/io/airlift/resolver/internal/ConsoleRepositoryListener.java
+++ b/resolver/src/main/java/io/airlift/resolver/internal/ConsoleRepositoryListener.java
@@ -15,8 +15,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonatype.aether.AbstractRepositoryListener;
-import org.sonatype.aether.RepositoryEvent;
+import org.eclipse.aether.AbstractRepositoryListener;
+import org.eclipse.aether.RepositoryEvent;
/**
* A simplistic repository listener that logs events to the console.
diff --git a/resolver/src/main/java/io/airlift/resolver/internal/ConsoleTransferListener.java b/resolver/src/main/java/io/airlift/resolver/internal/ConsoleTransferListener.java
index c6fa1ad..1ec3d3c 100644
--- a/resolver/src/main/java/io/airlift/resolver/internal/ConsoleTransferListener.java
+++ b/resolver/src/main/java/io/airlift/resolver/internal/ConsoleTransferListener.java
@@ -15,9 +15,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonatype.aether.transfer.AbstractTransferListener;
-import org.sonatype.aether.transfer.TransferEvent;
-import org.sonatype.aether.transfer.TransferResource;
+import org.eclipse.aether.transfer.AbstractTransferListener;
+import org.eclipse.aether.transfer.TransferEvent;
+import org.eclipse.aether.transfer.TransferResource;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
diff --git a/resolver/src/main/java/io/airlift/resolver/internal/Slf4jLogger.java b/resolver/src/main/java/io/airlift/resolver/internal/Slf4jLogger.java
deleted file mode 100644
index 1c3df09..0000000
--- a/resolver/src/main/java/io/airlift/resolver/internal/Slf4jLogger.java
+++ /dev/null
@@ -1,141 +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 io.airlift.resolver.internal;
-
-import org.codehaus.plexus.logging.Logger;
-
-/**
- * Adapt an SLF4J logger to a Plexus logger, ignoring Plexus logger API parts that are not classical and
- * probably not really used.
- *
- * @author Jason van Zyl
- */
-public class Slf4jLogger
- implements Logger
-{
- private final org.slf4j.Logger logger;
-
- public Slf4jLogger(org.slf4j.Logger logger)
- {
- this.logger = logger;
- }
-
- public void debug(String message)
- {
- logger.debug(message);
- }
-
- public void debug(String message, Throwable throwable)
- {
- logger.debug(message, throwable);
- }
-
- public boolean isDebugEnabled()
- {
- return logger.isDebugEnabled();
- }
-
- public void info(String message)
- {
- logger.info(message);
- }
-
- public void info(String message, Throwable throwable)
- {
- logger.info(message, throwable);
- }
-
- public boolean isInfoEnabled()
- {
- return logger.isInfoEnabled();
- }
-
- public void warn(String message)
- {
- logger.warn(message);
- }
-
- public void warn(String message, Throwable throwable)
- {
- logger.warn(message, throwable);
- }
-
- public boolean isWarnEnabled()
- {
- return logger.isWarnEnabled();
- }
-
- public void error(String message)
- {
- logger.error(message);
- }
-
- public void error(String message, Throwable throwable)
- {
- logger.error(message, throwable);
- }
-
- public boolean isErrorEnabled()
- {
- return logger.isErrorEnabled();
- }
-
- public void fatalError(String message)
- {
- logger.error(message);
- }
-
- public void fatalError(String message, Throwable throwable)
- {
- logger.error(message, throwable);
- }
-
- public boolean isFatalErrorEnabled()
- {
- return logger.isErrorEnabled();
- }
-
- /**
- * Warning: ignored (always return 0 == Logger.LEVEL_DEBUG
).
- */
- public int getThreshold()
- {
- return 0;
- }
-
- /**
- * Warning: ignored.
- */
- public void setThreshold(int threshold)
- {
- }
-
- /**
- * Warning: ignored (always return null
).
- */
- public Logger getChildLogger(String name)
- {
- return null;
- }
-
- public String getName()
- {
- return logger.getName();
- }
-}
diff --git a/resolver/src/main/java/io/airlift/resolver/internal/Slf4jLoggerManager.java b/resolver/src/main/java/io/airlift/resolver/internal/Slf4jLoggerManager.java
deleted file mode 100644
index 7422b9e..0000000
--- a/resolver/src/main/java/io/airlift/resolver/internal/Slf4jLoggerManager.java
+++ /dev/null
@@ -1,142 +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 io.airlift.resolver.internal;
-
-import org.codehaus.plexus.logging.Logger;
-import org.codehaus.plexus.logging.LoggerManager;
-import org.slf4j.ILoggerFactory;
-import org.slf4j.LoggerFactory;
-
-/**
- * Use an SLF4J {@link org.slf4j.ILoggerFactory} as a backing for a Plexus {@link org.codehaus.plexus.logging.LoggerManager},
- * ignoring Plexus logger API parts that are not classical and probably not really used.
- *
- * @author Jason van Zyl
- * @since 3.1
- */
-public class Slf4jLoggerManager
- implements LoggerManager
-{
- private final ILoggerFactory loggerFactory;
-
- public Slf4jLoggerManager()
- {
- loggerFactory = LoggerFactory.getILoggerFactory();
- }
-
- public Logger getLoggerForComponent(String role)
- {
- return new Slf4jLogger(loggerFactory.getLogger(role));
- }
-
- /**
- * The logger name for a component with a non-null hint is role.hint
.
- * Warning: this does not conform to logger name as class name convention.
- * (and what about null
and default
hint equivalence?)
- */
- public Logger getLoggerForComponent(String role, String hint)
- {
- return (null == hint
- ? getLoggerForComponent(role)
- : new Slf4jLogger(loggerFactory.getLogger(role + '.' + hint)));
- }
-
- //
- // Trying to give loggers back is a bad idea. Ceki said so :-)
- // notice to self: what was this method supposed to do?
- //
-
- /**
- * Warning: ignored.
- */
- @Override
- public void setThreshold(String role, int threshold)
- {
- }
-
- /**
- * Warning: ignored.
- */
- @Override
- public void setThreshold(String role, String roleHint, int threshold)
- {
- }
-
- /**
- * Warning: ignored.
- */
- @Override
- public int getThreshold(String role)
- {
- return 0;
- }
-
- /**
- * Warning: ignored.
- */
- @Override
- public int getThreshold(String role, String roleHint)
- {
- return 0;
- }
-
- /**
- * Warning: ignored.
- */
- public void returnComponentLogger(String role)
- {
- }
-
- /**
- * Warning: ignored.
- */
- public void returnComponentLogger(String role, String hint)
- {
- }
-
- /**
- * Warning: ignored (always return 0
).
- */
- public int getThreshold()
- {
- return 0;
- }
-
- /**
- * Warning: ignored.
- */
- public void setThreshold(int threshold)
- {
- }
-
- /**
- * Warning: ignored.
- */
- public void setThresholds(int threshold)
- {
- }
-
- /**
- * Warning: ignored (always return 0
).
- */
- public int getActiveLoggerCount()
- {
- return 0;
- }
-}
diff --git a/resolver/src/test/java/io/airlift/resolver/ArtifactResolverTest.java b/resolver/src/test/java/io/airlift/resolver/ArtifactResolverTest.java
index f59562b..79a1de4 100644
--- a/resolver/src/test/java/io/airlift/resolver/ArtifactResolverTest.java
+++ b/resolver/src/test/java/io/airlift/resolver/ArtifactResolverTest.java
@@ -14,9 +14,9 @@
package io.airlift.resolver;
import com.google.common.collect.ImmutableList;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.resolution.DependencyResolutionException;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.resolution.DependencyResolutionException;
import org.testng.Assert;
import org.testng.annotations.Test;