mirror of https://github.com/apache/maven.git
Resolver updates (#1495)
This commit is contained in:
parent
64e9447926
commit
febfd2b5c9
|
@ -214,7 +214,7 @@ public abstract class AbstractSession implements InternalSession {
|
|||
public Session withLocalRepository(@Nonnull LocalRepository localRepository) {
|
||||
nonNull(localRepository, "localRepository");
|
||||
if (session.getLocalRepository() != null
|
||||
&& Objects.equals(session.getLocalRepository().getBasedir().toPath(), localRepository.getPath())) {
|
||||
&& Objects.equals(session.getLocalRepository().getBasePath(), localRepository.getPath())) {
|
||||
return this;
|
||||
}
|
||||
org.eclipse.aether.repository.LocalRepository repository = toRepository(localRepository);
|
||||
|
@ -293,13 +293,10 @@ public abstract class AbstractSession implements InternalSession {
|
|||
|
||||
@Override
|
||||
public org.eclipse.aether.artifact.Artifact toArtifact(Artifact artifact) {
|
||||
File file = getService(ArtifactManager.class)
|
||||
.getPath(artifact)
|
||||
.map(Path::toFile)
|
||||
.orElse(null);
|
||||
Path path = getService(ArtifactManager.class).getPath(artifact).orElse(null);
|
||||
if (artifact instanceof DefaultArtifact) {
|
||||
org.eclipse.aether.artifact.Artifact a = ((DefaultArtifact) artifact).getArtifact();
|
||||
if (Objects.equals(file, a.getFile())) {
|
||||
if (Objects.equals(path, a.getPath())) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
@ -310,7 +307,7 @@ public abstract class AbstractSession implements InternalSession {
|
|||
artifact.getExtension(),
|
||||
artifact.getVersion().toString(),
|
||||
null,
|
||||
file);
|
||||
path);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -69,7 +69,7 @@ public class DefaultArtifactResolver implements ArtifactResolver {
|
|||
session.getRepositorySystem().resolveArtifacts(session.getSession(), requests);
|
||||
for (ArtifactResult result : results) {
|
||||
Artifact artifact = session.getArtifact(result.getArtifact());
|
||||
Path path = result.getArtifact().getFile().toPath();
|
||||
Path path = result.getArtifact().getPath();
|
||||
artifactManager.setPath(artifact, path);
|
||||
paths.put(artifact, path);
|
||||
}
|
||||
|
|
|
@ -53,6 +53,6 @@ public class DefaultLocalRepository implements LocalRepository {
|
|||
@Nonnull
|
||||
@Override
|
||||
public Path getPath() {
|
||||
return repository.getBasedir().toPath();
|
||||
return repository.getBasePath();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class DefaultLocalRepositoryManager implements LocalRepositoryManager {
|
|||
InternalSession session, LocalRepository local) {
|
||||
org.eclipse.aether.repository.LocalRepository repository = session.toRepository(local);
|
||||
if ("enhanced".equals(repository.getContentType())) {
|
||||
repository = new org.eclipse.aether.repository.LocalRepository(repository.getBasedir(), "");
|
||||
repository = new org.eclipse.aether.repository.LocalRepository(repository.getBasePath(), "");
|
||||
}
|
||||
return session.getRepositorySystem().newLocalRepositoryManager(session.getSession(), repository);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class DefaultRepositoryFactory implements RepositoryFactory {
|
|||
|
||||
@Override
|
||||
public LocalRepository createLocal(Path path) {
|
||||
return new DefaultLocalRepository(new org.eclipse.aether.repository.LocalRepository(path.toFile()));
|
||||
return new DefaultLocalRepository(new org.eclipse.aether.repository.LocalRepository(path));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -54,7 +54,7 @@ public class DefaultTransport implements Transport {
|
|||
throw new IllegalArgumentException("Supplied relative URI escapes baseUrl");
|
||||
}
|
||||
GetTask getTask = new GetTask(source);
|
||||
getTask.setDataFile(target.toFile());
|
||||
getTask.setDataPath(target);
|
||||
try {
|
||||
transporter.get(getTask);
|
||||
return true;
|
||||
|
@ -110,7 +110,7 @@ public class DefaultTransport implements Transport {
|
|||
}
|
||||
|
||||
PutTask putTask = new PutTask(target);
|
||||
putTask.setDataFile(source.toFile());
|
||||
putTask.setDataPath(source);
|
||||
try {
|
||||
transporter.put(putTask);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -89,6 +89,7 @@ abstract class MavenMetadata extends AbstractMetadata implements MergeableMetada
|
|||
return path;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void merge(File existing, File result) throws RepositoryException {
|
||||
merge(existing != null ? existing.toPath() : null, result != null ? result.toPath() : null);
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ import org.eclipse.aether.util.graph.manager.ClassicDependencyManager;
|
|||
import org.eclipse.aether.util.graph.selector.AndDependencySelector;
|
||||
import org.eclipse.aether.util.graph.selector.ExclusionDependencySelector;
|
||||
import org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer;
|
||||
import org.eclipse.aether.util.graph.transformer.ConfigurableVersionSelector;
|
||||
import org.eclipse.aether.util.graph.transformer.ConflictResolver;
|
||||
import org.eclipse.aether.util.graph.transformer.NearestVersionSelector;
|
||||
import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector;
|
||||
import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class MavenSessionBuilderSupplier implements Supplier<SessionBuilder> {
|
|||
protected DependencyGraphTransformer getDependencyGraphTransformer() {
|
||||
return new ChainedDependencyGraphTransformer(
|
||||
new ConflictResolver(
|
||||
new NearestVersionSelector(), new ManagedScopeSelector(getScopeManager()),
|
||||
new ConfigurableVersionSelector(), new ManagedScopeSelector(getScopeManager()),
|
||||
new SimpleOptionalitySelector(), new ManagedScopeDeriver(getScopeManager())),
|
||||
new ManagedDependencyContextRefiner(getScopeManager()));
|
||||
}
|
||||
|
|
|
@ -409,7 +409,7 @@ class ReactorReader implements MavenWorkspaceReader {
|
|||
LOGGER.info("Copying {} to project local repository", artifact);
|
||||
Files.createDirectories(target.getParent());
|
||||
Files.copy(
|
||||
artifact.getFile().toPath(),
|
||||
artifact.getPath(),
|
||||
target,
|
||||
StandardCopyOption.REPLACE_EXISTING,
|
||||
StandardCopyOption.COPY_ATTRIBUTES);
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.maven.internal.impl;
|
|||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
@ -67,10 +66,7 @@ public class DefaultArtifactManager implements ArtifactManager {
|
|||
}
|
||||
Path path = paths.get(id);
|
||||
if (path == null && artifact instanceof DefaultArtifact) {
|
||||
File file = ((DefaultArtifact) artifact).getArtifact().getFile();
|
||||
if (file != null) {
|
||||
path = file.toPath();
|
||||
}
|
||||
path = ((DefaultArtifact) artifact).getArtifact().getPath();
|
||||
}
|
||||
return Optional.ofNullable(path);
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class TestRepositoryConnector implements RepositoryConnector {
|
|||
for (ArtifactDownload download : artifactDownloads) {
|
||||
File remoteFile = new File(basedir, path(download.getArtifact()));
|
||||
try {
|
||||
Path dest = download.getFile().toPath();
|
||||
Path dest = download.getPath();
|
||||
Files.createDirectories(dest.getParent());
|
||||
Files.copy(remoteFile.toPath(), dest);
|
||||
} catch (IOException e) {
|
||||
|
@ -91,7 +91,7 @@ public class TestRepositoryConnector implements RepositoryConnector {
|
|||
for (final MetadataDownload download : metadataDownloads) {
|
||||
File remoteFile = new File(basedir, path(download.getMetadata()));
|
||||
try {
|
||||
Path dest = download.getFile().toPath();
|
||||
Path dest = download.getPath();
|
||||
Files.createDirectories(dest.getParent());
|
||||
Files.copy(remoteFile.toPath(), dest);
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -1217,7 +1217,7 @@ public class DefaultModelBuilder implements ModelBuilder {
|
|||
}
|
||||
|
||||
if (modelSource instanceof FileModelSource) {
|
||||
model = model.withPomFile(((FileModelSource) modelSource).getFile().toPath());
|
||||
model = model.withPomFile(((FileModelSource) modelSource).getPath());
|
||||
}
|
||||
|
||||
Model retModel = new Model(model);
|
||||
|
|
Loading…
Reference in New Issue