goutamadwant commented on code in PR #13081:
URL: https://github.com/apache/maven/pull/13081#discussion_r3976169522
##########
compat/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java:
##########
@@ -1187,136 +1182,210 @@ 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 importMgmt =
loadDependencyManagement(dependency, model, request, problems, importIds);
+ if (importMgmt != null) {
+ if (importMgmts == null) {
+ importMgmts = new ArrayList<>();
+ }
+ importMgmts.add(importMgmt);
}
+ }
- 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, importMgmts,
request, problems);
+ }
- continue;
+ @SuppressWarnings("checkstyle:methodlength")
Review Comment:
Done.
--
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]