mirror of https://github.com/apache/maven.git
[MNG-8326] The ModelBuilder cannot import BOM with classifiers
This commit is contained in:
parent
912c1177ee
commit
c06965db88
|
@ -59,6 +59,7 @@ public interface ModelResolver extends Service {
|
|||
parent.getGroupId(),
|
||||
parent.getArtifactId(),
|
||||
parent.getVersion(),
|
||||
null,
|
||||
version -> modified.set(parent.withVersion(version)));
|
||||
}
|
||||
|
||||
|
@ -85,6 +86,7 @@ public interface ModelResolver extends Service {
|
|||
dependency.getGroupId(),
|
||||
dependency.getArtifactId(),
|
||||
dependency.getVersion(),
|
||||
dependency.getClassifier(),
|
||||
version -> modified.set(dependency.withVersion(version)));
|
||||
}
|
||||
|
||||
|
@ -95,6 +97,7 @@ public interface ModelResolver extends Service {
|
|||
@Nonnull String groupId,
|
||||
@Nonnull String artifactId,
|
||||
@Nonnull String version,
|
||||
@Nullable String classifier,
|
||||
@Nonnull Consumer<String> resolvedVersion)
|
||||
throws ModelResolverException;
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ public class DefaultModelResolver implements ModelResolver {
|
|||
parent.getArtifactId(),
|
||||
parent.getVersion(),
|
||||
"parent",
|
||||
null,
|
||||
parent.getLocation("version"),
|
||||
version -> modified.set(parent.withVersion(version)));
|
||||
}
|
||||
|
@ -89,6 +90,7 @@ public class DefaultModelResolver implements ModelResolver {
|
|||
dependency.getArtifactId(),
|
||||
dependency.getVersion(),
|
||||
"dependency",
|
||||
dependency.getClassifier(),
|
||||
dependency.getLocation("version"),
|
||||
version -> modified.set(dependency.withVersion(version)));
|
||||
}
|
||||
|
@ -100,9 +102,11 @@ public class DefaultModelResolver implements ModelResolver {
|
|||
@Nonnull String groupId,
|
||||
@Nonnull String artifactId,
|
||||
@Nonnull String version,
|
||||
@Nullable String classifier,
|
||||
@Nonnull Consumer<String> resolvedVersion)
|
||||
throws ModelResolverException {
|
||||
return resolveModel(session, repositories, groupId, artifactId, version, null, null, resolvedVersion);
|
||||
return resolveModel(
|
||||
session, repositories, groupId, artifactId, version, null, classifier, null, resolvedVersion);
|
||||
}
|
||||
|
||||
@SuppressWarnings("checkstyle:ParameterNumber")
|
||||
|
@ -113,11 +117,13 @@ public class DefaultModelResolver implements ModelResolver {
|
|||
String artifactId,
|
||||
String version,
|
||||
String type,
|
||||
String classifier,
|
||||
InputLocation location,
|
||||
Consumer<String> resolvedVersion)
|
||||
throws ModelResolverException {
|
||||
try {
|
||||
ArtifactCoordinates coords = session.createArtifactCoordinates(groupId, artifactId, version, "pom");
|
||||
ArtifactCoordinates coords =
|
||||
session.createArtifactCoordinates(groupId, artifactId, version, classifier, "pom", null);
|
||||
if (coords.getVersionConstraint().getVersionRange() != null
|
||||
&& coords.getVersionConstraint().getVersionRange().getUpperBoundary() == null) {
|
||||
// Message below is checked for in the MNG-2199 core IT.
|
||||
|
@ -143,7 +149,7 @@ public class DefaultModelResolver implements ModelResolver {
|
|||
resolvedVersion.accept(newVersion);
|
||||
}
|
||||
|
||||
Path path = getPath(session, repositories, groupId, artifactId, newVersion);
|
||||
Path path = getPath(session, repositories, groupId, artifactId, newVersion, classifier);
|
||||
return new ResolverModelSource(path, groupId + ":" + artifactId + ":" + newVersion);
|
||||
} catch (VersionRangeResolverException | ArtifactResolverException e) {
|
||||
throw new ModelResolverException(
|
||||
|
@ -163,9 +169,10 @@ public class DefaultModelResolver implements ModelResolver {
|
|||
List<RemoteRepository> repositories,
|
||||
String groupId,
|
||||
String artifactId,
|
||||
String newVersion) {
|
||||
String version,
|
||||
String classifier) {
|
||||
DownloadedArtifact resolved = session.resolveArtifact(
|
||||
session.createArtifactCoordinates(groupId, artifactId, newVersion, "pom"), repositories);
|
||||
session.createArtifactCoordinates(groupId, artifactId, version, classifier, "pom", null), repositories);
|
||||
return resolved.getPath();
|
||||
}
|
||||
|
||||
|
|
|
@ -136,6 +136,7 @@ public class ConsumerPomBuilderTest extends AbstractRepositoryTestCase {
|
|||
String groupId,
|
||||
String artifactId,
|
||||
String version,
|
||||
String classifier,
|
||||
Consumer<String> resolvedVersion)
|
||||
throws ModelResolverException {
|
||||
String id = groupId + ":" + artifactId + ":" + version;
|
||||
|
|
Loading…
Reference in New Issue