Skip to content
Latchkey

Maven "Unresolved/invalid version" (property placeholder) in CI

A project using CI-friendly versions (${revision}/${sha1}) did not have the property set, so the version stays a literal ${revision}. Installs and deploys then use a bad coordinate, and consumers fail to resolve it.

What this error means

The build installs/deploys an artifact whose version is literally ${revision}, or a downstream resolve fails with "Could not find artifact com.example:app:jar:${revision}".

mvn output
[INFO] Installing /home/runner/work/app/target/app-${revision}.jar to
/home/runner/.m2/repository/com/example/app/${revision}/app-${revision}.jar
[ERROR] Could not find artifact com.example:app:jar:${revision} in central

Common causes

The revision property is never set

The POM uses <version>${revision}</version> but the build does not pass -Drevision=... or define it, so the placeholder is not substituted.

Missing flatten plugin for CI-friendly versions

Without flattening, the installed POM keeps the unresolved ${revision}, breaking downstream resolution.

How to fix it

Pass the revision at build time

Provide the property so the placeholder resolves to a concrete version.

Terminal
mvn -B -Drevision=1.0.${{ github.run_number }} deploy

Use the flatten plugin to resolve placeholders

flatten-maven-plugin rewrites the installed POM with the resolved version so consumers see a real coordinate.

pom.xml
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>flatten-maven-plugin</artifactId>
  <version>1.6.0</version>
</plugin>

How to prevent it

  • Set -Drevision (or define the property) in every build.
  • Use flatten-maven-plugin with CI-friendly versions.
  • Verify the installed POM has a resolved version, not a placeholder.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →