{"record":{"id":"1997a1cb74bcb9af","repo":"apache/maven","slug":"the-consumer-pom-for-cannot-be-created-because","errorCode":null,"errorMessage":"The consumer POM for {} cannot be created because the POM contains mixins. Mixins are not supported in the default consumer POM format. You have the following options to resolve this:\n  1. Preserve the model version by setting 'preserve.model.version=true' to generate a consumer POM with <modelVersion>4.2.0</modelVersion>, which supports mixins\n  2. Enable flattening by setting the property 'maven.consumer.pom.flatten=true' to remove mixins during transformation\n  3. Remove the mixins from your POM","messagePattern":"The consumer POM for \\{\\} cannot be created because the POM contains mixins\\. Mixins are not supported in the default consumer POM format\\. You have the following options to resolve this:\n  1\\. Preserve the model version by setting 'preserve\\.model\\.version=true' to generate a consumer POM with <modelVersion>4\\.2\\.0</modelVersion>, which supports mixins\n  2\\. Enable flattening by setting the property 'maven\\.consumer\\.pom\\.flatten=true' to remove mixins during transformation\n  3\\. Remove the mixins from your POM","errorType":"exception","errorClass":"MavenException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/internal/transformation/impl/DefaultConsumerPomBuilder.java","lineNumber":129,"sourceCode":"    @SuppressWarnings(\"checkstyle:ParameterNumber\")\n    DefaultConsumerPomBuilder(LifecycleBindingsInjector lifecycleBindingsInjector) {\n        this.lifecycleBindingsInjector = lifecycleBindingsInjector;\n    }\n\n    @Override\n    public Model build(RepositorySystemSession session, MavenProject project, ModelSource src)\n            throws ModelBuilderException {\n        Model model = project.getModel().getDelegate();\n        boolean flattenEnabled = Features.consumerPomFlatten(session.getConfigProperties());\n        String packaging = model.getPackaging();\n        String originalPackaging = project.getOriginalModel().getPackaging();\n\n        // Check if this is a BOM (original packaging is \"bom\")\n        boolean isBom = BOM_PACKAGING.equals(originalPackaging);\n\n        // Check if mixins are present without flattening enabled\n        if (!model.getMixins().isEmpty() && !flattenEnabled && !model.isPreserveModelVersion()) {\n            throw new MavenException(\"The consumer POM for \"\n                    + project.getId()\n                    + \" cannot be created because the POM contains mixins. \"\n                    + \"Mixins are not supported in the default consumer POM format. \"\n                    + \"You have the following options to resolve this:\" + System.lineSeparator()\n                    + \"  1. Preserve the model version by setting 'preserve.model.version=true' to generate a consumer POM with <modelVersion>4.2.0</modelVersion>, which supports mixins\"\n                    + System.lineSeparator()\n                    + \"  2. Enable flattening by setting the property 'maven.consumer.pom.flatten=true' to remove mixins during transformation\"\n                    + System.lineSeparator()\n                    + \"  3. Remove the mixins from your POM\");\n        }\n\n        // Check if consumer POM flattening is disabled\n        if (!flattenEnabled) {\n            // When flattening is disabled, treat non-POM projects like parent POMs\n            // Apply only basic transformations without flattening dependency management\n            // BOMs always need the effective (interpolated) model because transformBom()\n            // strips parent and properties — any ${...} references would become dangling.\n            // The flatten flag has no semantic effect on BOMs (transformBom always produces","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/internal/transformation/impl/DefaultConsumerPomBuilder.java#L111-L147","documentation":"DefaultConsumerPomBuilder refuses to generate the default 4.0.0 consumer POM when the model uses <mixins>: mixins are a 4.1+ model feature that the 4.0.0 consumer format cannot represent. The build() method only proceeds when flattening (maven.consumer.pom.flatten=true, which inlines/removes mixins) is enabled or the model version is preserved (preserve.model.version=true, keeping a 4.2.0 consumer POM).","triggerScenarios":"Running install/deploy on a project whose POM declares <mixins>, with both 'maven.consumer.pom.flatten' unset/false and 'preserve.model.version' unset/false. The consumer POM builder then cannot downgrade to 4.0.0 and throws MavenException before writing the attached artifact.","commonSituations":"Adopting Maven 4 mixins for POM composition and then running a stock 'mvn deploy' without the companion properties; CI pipelines that flatten was forgotten to be configured; building a 4.x project with older tooling assumptions where mixins were silently ignored.","solutions":["Set 'maven.consumer.pom.flatten=true' (e.g. in .mvn/maven.config or the POM properties) so mixins are flattened away during transformation","Or set 'preserve.model.version=true' to emit a 4.2.0 consumer POM that still supports mixins (Maven 4 consumers only)","Or remove the <mixins> element and inline its content manually","Verify the property actually reaches the session — it must be resolvable at deploy time, not only locally"],"exampleFix":"<!-- before -->\n<project>\n  <mixins><mixin>org.acme:shared-config:1.0</mixin></mixins>\n  <!-- no properties: build fails with this error on install/deploy -->\n\n<!-- after -->\n<properties>\n  <maven.consumer.pom.flatten>true</maven.consumer.pom.flatten>\n</properties>","handlingStrategy":"validation","validationCode":"// before install/deploy\nboolean hasMixins = !model.getMixins().isEmpty();\nboolean flatten = \"true\".equals(System.getProperty(\"maven.consumer.pom.flatten\", props.get(\"maven.consumer.pom.flatten\")));\nif (hasMixins && !flatten && !model.isPreserveModelVersion()) {\n    throw new IllegalStateException(\"Configure maven.consumer.pom.flatten=true before deploying\");\n}","typeGuard":null,"tryCatchPattern":"catch (MavenException e) {\n    if (e.getMessage().contains(\"contains mixins\")) {\n        // apply option 1/2/3 from the message, then retry the deploy\n    }\n}","preventionTips":["Whenever you introduce <mixins>, set maven.consumer.pom.flatten=true in the same commit","Test 'mvn deploy' in a dry environment (local repo) before releasing","Keep consumer-facing POM features documented in the project README"],"tags":["maven","consumer-pom","mixins","model-version","deploy"],"backgroundTag":"consumer-pom-feature-unsupported","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}