gnodet commented on code in PR #13897:
URL: https://github.com/apache/maven/pull/13897#discussion_r4560603642
##########
impl/maven-core/src/main/java/org/apache/maven/internal/transformation/impl/DefaultConsumerPomBuilder.java:
##########
@@ -146,6 +154,25 @@ public Model build(RepositorySystemSession session,
MavenProject project, ModelS
+ " 3. Remove the mixins from your POM");
}
+ // Check if dependency includes are present without flattening enabled
+ if ((hasDependencyIncludes(model)
+ || (project.getOriginalModel() != null
+ && hasDependencyIncludes(
+
project.getOriginalModel().getDelegate())))
+ && !flattenEnabled
+ && !model.isPreserveModelVersion()) {
+ throw new MavenException("The consumer POM for "
+ + project.getId()
+ + " cannot be created because the POM contains dependency
inclusions (<includes>). "
+ + "Dependency inclusions are not supported in the default
consumer POM format. "
+ + "You have the following options to resolve this:" +
System.lineSeparator()
+ + " 1. Preserve the model version by setting
'preserve.model.version=true' to generate a consumer POM with
<modelVersion>4.2.0</modelVersion>, which supports <includes>"
+ + System.lineSeparator()
+ + " 2. Enable flattening by setting the property
'maven.consumer.pom.flatten=true' to remove <includes> during transformation"
Review Comment:
This option is incorrect for the BOM case.
`filterToOwnDependencyManagement()` preserves `import`-scoped entries in the
consumer BOM (including the `<includes>` element), so `MavenModelVersion` will
still return 4.2.0 — breaking Maven 3 compatibility. Either remove this option
from the error message, or update the flatten path to resolve the filtered
subset inline and strip `<includes>` from the consumer POM.
--
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]