{"record":{"id":"f41e0c7289f2ddf3","repo":"apache/maven","slug":"cannot-inline-property","errorCode":null,"errorMessage":"Cannot inline property {}","messagePattern":"Cannot inline property (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/internal/transformation/impl/PomInlinerTransformer.java","lineNumber":130,"sourceCode":"                .computeIfAbsent(\n                        PomInlinerTransformer.class.getName() + \".needsInlining\", ConcurrentHashMap::newKeySet);\n    }\n\n    @Override\n    public void injectTransformedArtifacts(RepositorySystemSession session, MavenProject project) throws IOException {\n        if (!Features.consumerPom(session.getConfigProperties())) {\n            try {\n                Model model = read(project.getFile().toPath());\n                String version = model.getVersion();\n                if (version == null && model.getParent() != null) {\n                    version = model.getParent().getVersion();\n                }\n                String newVersion;\n                if (version != null) {\n                    HashSet<String> usedProperties = new HashSet<>();\n                    newVersion = interpolator.interpolate(version.trim(), property -> {\n                        if (!session.getConfigProperties().containsKey(property)) {\n                            throw new IllegalArgumentException(\"Cannot inline property \" + property);\n                        }\n                        usedProperties.add(property);\n                        return (String) session.getConfigProperties().get(property);\n                    });\n                    if (!Objects.equals(version, newVersion)) {\n                        needsInlining(session).addAll(usedProperties);\n                    }\n                }\n            } catch (XMLStreamException e) {\n                throw new IOException(\"Problem during inlining POM\", e);\n            }\n        }\n    }\n}\n","sourceCodeStart":112,"sourceCodeEnd":145,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/internal/transformation/impl/PomInlinerTransformer.java#L112-L145","documentation":"PomInlinerTransformer runs when the consumer POM feature is DISABLED: to keep the published POM resolvable, it interpolates the project version and records which properties were inlined. If the version string references a property that is not present in the session's config properties, the callback throws 'Cannot inline property <name>'.","triggerScenarios":"A version like <version>${revision}</version> or ${my.version} where the property is not in the effective session configuration — e.g. defined only in a profile that is inactive at install/deploy time, filtered out by CI property injection, or simply missing — combined with consumer POM generation being off.","commonSituations":"CI pipelines using -Drevision=... where the deploy step runs in a different job without the property; properties defined in a parent that is not resolvable at that point; disabling the consumer POM feature while relying on ${revision}/${sha1}/${changelist} style versions without the flatten-plugin.","solutions":["Pass the missing property on the command line or CI environment at deploy time: mvn -Drevision=1.2.3 deploy","Better: add the flatten-maven-plugin (or enable the consumer POM feature) so the deployed POM has the version inlined for you","Define the property in the POM's <properties> with the default expected value","Verify with 'mvn help:evaluate -Dexpression=revision' that the property resolves in the exact profile/job that fails"],"exampleFix":"# before\nmvn deploy   # version is ${revision}, property not set -> Cannot inline property revision\n\n# after\nmvn -Drevision=1.2.3 deploy\n# or configure flatten-maven-plugin / enable consumer POM in .mvn/maven.config","handlingStrategy":"validation","validationCode":"// before deploy, verify every property referenced by <version> resolves\nString v = model.getVersion() != null ? model.getVersion() : model.getParent().getVersion();\nfor (String p : extractPropertyRefs(v)) { // regex \\\\$\\{([^}]+)\\}\n    if (!session.getConfigProperties().containsKey(p)) throw new IllegalStateException(\"Unset property: \" + p);\n}","typeGuard":null,"tryCatchPattern":"catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Cannot inline property\")) {\n        // pass the property with -D, or enable consumer POM/flatten, then retry\n    }\n}","preventionTips":["Run CI release jobs with all version properties (-Drevision=... etc.) explicit","Prefer the flatten-maven-plugin when consumer POM generation is off","Define default values for version properties in <properties> so local builds never miss them"],"tags":["maven","property-interpolation","version","deploy","pom-inlining"],"backgroundTag":"unresolvable-maven-property","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}