[ https://issues.apache.org/jira/browse/MNG-8210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17874455#comment-17874455 ]
ASF GitHub Bot commented on MNG-8210: ------------------------------------- Bukama commented on code in PR #1651: URL: https://github.com/apache/maven/pull/1651#discussion_r1720742298 ########## maven-api-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelValidator.java: ########## @@ -360,6 +360,61 @@ public void validateFileModel(Model m, ModelBuilderRequest request, ModelProblem m.getLocation("modules")); } } + String modelVersion = m.getModelVersion(); + if (modelVersion == null) { + String namespace = m.getNamespaceUri(); + if (namespace != null && namespace.startsWith(NAMESPACE_PREFIX)) { + modelVersion = namespace.substring(NAMESPACE_PREFIX.length()); + } + } + if (Objects.equals(modelVersion, ModelBuilder.MODEL_VERSION_4_0_0)) { + if (!m.getSubprojects().isEmpty()) { + addViolation( + problems, + Severity.ERROR, + Version.V40, + "subprojects", + null, + "unexpected subprojects element", + m.getLocation("subprojects")); + } + } else { + Set<String> subprojects = new HashSet<>(); + for (int i = 0, n = m.getSubprojects().size(); i < n; i++) { + String subproject = m.getSubprojects().get(i); + if (!subprojects.add(subproject)) { + addViolation( + problems, + Severity.ERROR, + Version.V41, + "subprojects.subproject[" + i + "]", + null, + "specifies duplicate subproject " + subproject, + m.getLocation("subprojects")); + } + } + if (!modules.isEmpty()) { + if (subprojects.isEmpty()) { + addViolation( + problems, + Severity.WARNING, + Version.V41, + "modules", + null, + "deprecated modules element, use subprojects instead", + m.getLocation("modules")); + } else { + addViolation( + problems, + Severity.WARNING, Review Comment: Why not error? > Rename maven module to subproject and make them optional in the POM > ------------------------------------------------------------------- > > Key: MNG-8210 > URL: https://issues.apache.org/jira/browse/MNG-8210 > Project: Maven > Issue Type: New Feature > Reporter: Guillaume Nodet > Assignee: Guillaume Nodet > Priority: Major > Fix For: 4.0.0-beta-4 > > > The maven "module" term is used to actually refer to subproject (since those > are loaded as MavenProject, or Project in the v4 api). The only reference to > "module" is in the POM really, so it would make sense to rename to > {{subproject}} instead. -- This message was sent by Atlassian Jira (v8.20.10#820010)