mirror of https://github.com/apache/maven.git
[MNG-8172] Fix site building (#1594)
This commit is contained in:
parent
e335f95dfd
commit
40e41153c2
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
package org.apache.maven.internal.impl.resolver;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -33,6 +36,7 @@ import org.apache.maven.api.services.ArtifactResolverException;
|
|||
import org.apache.maven.api.services.ModelResolver;
|
||||
import org.apache.maven.api.services.ModelResolverException;
|
||||
import org.apache.maven.api.services.ModelSource;
|
||||
import org.apache.maven.api.services.Source;
|
||||
import org.apache.maven.api.services.VersionRangeResolverException;
|
||||
|
||||
/**
|
||||
|
@ -74,7 +78,34 @@ public class DefaultModelResolver implements ModelResolver {
|
|||
|
||||
Map.Entry<org.apache.maven.api.Artifact, Path> resolved =
|
||||
session.resolveArtifact(session.createArtifactCoordinate(groupId, artifactId, newVersion, "pom"));
|
||||
return ModelSource.fromPath(resolved.getValue(), groupId + ":" + artifactId + ":" + newVersion);
|
||||
Path path = resolved.getValue();
|
||||
String location = groupId + ":" + artifactId + ":" + newVersion;
|
||||
return new ModelSource() {
|
||||
@Override
|
||||
public ModelSource resolve(ModelLocator modelLocator, String relative) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getPath() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream openStream() throws IOException {
|
||||
return Files.newInputStream(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Source resolve(String relative) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
} catch (VersionRangeResolverException | ArtifactResolverException e) {
|
||||
throw new ModelResolverException(
|
||||
e.getMessage() + " (remote repositories: "
|
||||
|
|
|
@ -92,7 +92,6 @@ import org.apache.maven.bridge.MavenRepositorySystem;
|
|||
import org.apache.maven.internal.impl.InternalSession;
|
||||
import org.apache.maven.internal.impl.resolver.DefaultModelCache;
|
||||
import org.apache.maven.internal.impl.resolver.DefaultModelRepositoryHolder;
|
||||
import org.apache.maven.model.building.ArtifactModelSource;
|
||||
import org.apache.maven.model.building.DefaultModelProblem;
|
||||
import org.apache.maven.model.building.FileModelSource;
|
||||
import org.apache.maven.model.building.ModelSource2;
|
||||
|
@ -177,8 +176,6 @@ public class DefaultProjectBuilder implements ProjectBuilder {
|
|||
static ModelSource toSource(org.apache.maven.model.building.ModelSource modelSource) {
|
||||
if (modelSource instanceof FileModelSource fms) {
|
||||
return ModelSource.fromPath(fms.getPath());
|
||||
} else if (modelSource instanceof ArtifactModelSource ams) {
|
||||
return ModelSource.fromPath(ams.getPath(), ams.toString());
|
||||
} else {
|
||||
return new ModelSource() {
|
||||
@Override
|
||||
|
|
|
@ -37,7 +37,6 @@ import java.util.Optional;
|
|||
import org.apache.maven.api.model.Model;
|
||||
import org.apache.maven.api.spi.ModelParser;
|
||||
import org.apache.maven.api.spi.ModelParserException;
|
||||
import org.apache.maven.building.Source;
|
||||
import org.apache.maven.model.io.ModelParseException;
|
||||
import org.apache.maven.model.io.ModelReader;
|
||||
import org.apache.maven.model.locator.ModelLocator;
|
||||
|
@ -133,10 +132,6 @@ public class DefaultModelProcessor implements ModelProcessor {
|
|||
|
||||
protected org.apache.maven.api.model.Model read(
|
||||
Path pomFile, InputStream input, Reader reader, Map<String, ?> options) throws IOException {
|
||||
Source source = (Source) options.get(ModelProcessor.SOURCE);
|
||||
if (pomFile == null && source instanceof org.apache.maven.building.FileSource) {
|
||||
pomFile = ((org.apache.maven.building.FileSource) source).getPath();
|
||||
}
|
||||
if (pomFile != null) {
|
||||
Path projectDirectory = pomFile.getParent();
|
||||
List<ModelParserException> exceptions = new ArrayList<>();
|
||||
|
|
Loading…
Reference in New Issue