goutamadwant commented on code in PR #13081:
URL: https://github.com/apache/maven/pull/13081#discussion_r4090310714
##########
compat/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java:
##########
@@ -1187,136 +1182,227 @@ private void importDependencyManagement(
it.remove();
- String groupId = dependency.getGroupId();
- String artifactId = dependency.getArtifactId();
- String version = dependency.getVersion();
-
- if (groupId == null || groupId.length() <= 0) {
- problems.add(new ModelProblemCollectorRequest(Severity.ERROR,
Version.BASE)
-
.setMessage("'dependencyManagement.dependencies.dependency.groupId' for "
- + dependency.getManagementKey() + " is
missing.")
- .setLocation(dependency.getLocation("")));
- continue;
- }
- if (artifactId == null || artifactId.length() <= 0) {
- problems.add(new ModelProblemCollectorRequest(Severity.ERROR,
Version.BASE)
-
.setMessage("'dependencyManagement.dependencies.dependency.artifactId' for "
- + dependency.getManagementKey() + " is
missing.")
- .setLocation(dependency.getLocation("")));
- continue;
- }
- if (version == null || version.length() <= 0) {
- problems.add(new ModelProblemCollectorRequest(Severity.ERROR,
Version.BASE)
-
.setMessage("'dependencyManagement.dependencies.dependency.version' for "
- + dependency.getManagementKey() + " is
missing.")
- .setLocation(dependency.getLocation("")));
- continue;
+ DependencyManagement importedManagement =
+ loadDependencyManagement(dependency, model, request,
problems, importIds);
+ if (importedManagement != null) {
+ if (importedManagements == null) {
+ importedManagements = new ArrayList<>();
+ }
+ importedManagements.add(importedManagement);
}
+ }
- String imported = groupId + ':' + artifactId + ':' + version;
+ importIds.remove(importing);
- if (importIds.contains(imported)) {
- StringBuilder message =
- new StringBuilder("The dependencies of type=pom and
with scope=import form a cycle: ");
- for (String modelId : importIds) {
- message.append(modelId);
- message.append(" -> ");
- }
- message.append(imported);
- problems.add(
- new ModelProblemCollectorRequest(Severity.ERROR,
Version.BASE).setMessage(message.toString()));
+ dependencyManagementImporter.importManagement(model,
importedManagements, request, problems);
+ }
- continue;
+ private DependencyManagement loadDependencyManagement(
Review Comment:
Addressed. The compat builder retains its previous BOM-import behavior. Only
the workspace-miss guard for a missing fallback ModelResolver remains, with
focused tests for workspace hits, misses, fallback, resolver failure, and
unchanged relocation behavior.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]