apache/maven · error · IllegalArgumentException
Cannot inline property {}
Error message
Cannot inline property {} What it means
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>'.
Source
Thrown at impl/maven-core/src/main/java/org/apache/maven/internal/transformation/impl/PomInlinerTransformer.java:130
.computeIfAbsent(
PomInlinerTransformer.class.getName() + ".needsInlining", ConcurrentHashMap::newKeySet);
}
@Override
public void injectTransformedArtifacts(RepositorySystemSession session, MavenProject project) throws IOException {
if (!Features.consumerPom(session.getConfigProperties())) {
try {
Model model = read(project.getFile().toPath());
String version = model.getVersion();
if (version == null && model.getParent() != null) {
version = model.getParent().getVersion();
}
String newVersion;
if (version != null) {
HashSet<String> usedProperties = new HashSet<>();
newVersion = interpolator.interpolate(version.trim(), property -> {
if (!session.getConfigProperties().containsKey(property)) {
throw new IllegalArgumentException("Cannot inline property " + property);
}
usedProperties.add(property);
return (String) session.getConfigProperties().get(property);
});
if (!Objects.equals(version, newVersion)) {
needsInlining(session).addAll(usedProperties);
}
}
} catch (XMLStreamException e) {
throw new IOException("Problem during inlining POM", e);
}
}
}
}
View on GitHub (pinned to e4093d4e12)
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
Example fix
# before
mvn deploy # version is ${revision}, property not set -> Cannot inline property revision
# after
mvn -Drevision=1.2.3 deploy
# or configure flatten-maven-plugin / enable consumer POM in .mvn/maven.config Defensive patterns
Strategy: validation
Validate before calling
// before deploy, verify every property referenced by <version> resolves
String v = model.getVersion() != null ? model.getVersion() : model.getParent().getVersion();
for (String p : extractPropertyRefs(v)) { // regex \\$\{([^}]+)\}
if (!session.getConfigProperties().containsKey(p)) throw new IllegalStateException("Unset property: " + p);
} Try / catch
catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Cannot inline property")) {
// pass the property with -D, or enable consumer POM/flatten, then retry
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Error installing metadata: {}
- Error while deploying metadata: {}
- Unable to read Maven version from maven-core
- The consumer POM for {} cannot be created because the POM co
- Required Maven version {} is not met by current version {}
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/f41e0c7289f2ddf3.
Report an issue: GitHub.