Skip to content
Latchkey

Maven "No goals have been specified" / Lifecycle Errors in CI

Maven was invoked without a goal or phase to run, or with a phase it does not recognize. Maven needs an explicit lifecycle phase (compile, test, package, verify, install) or a plugin goal to do anything.

What this error means

A bare mvn (or mvn with a typo like mvn instal) fails immediately with No goals have been specified for this build or Unknown lifecycle phase, suggesting valid phases.

mvn output
[ERROR] No goals have been specified for this build. You must specify a valid
lifecycle phase or a goal in the format <plugin-prefix>:<goal> ...
# or
[ERROR] Unknown lifecycle phase "instal". You must specify a valid lifecycle phase ...

Common causes

No phase or goal passed

A CI step ran mvn with only flags (or nothing). Maven has no default goal, so it stops.

Misspelled lifecycle phase

A typo such as instal, tests, or packge is not a recognized phase, so Maven rejects the whole build.

How to fix it

Pass an explicit phase

Give Maven a real lifecycle phase. In CI, verify or install is typical.

Terminal
mvn -B clean verify
# or for publishing locally:
mvn -B clean install

Check the phase spelling

  1. Valid default-lifecycle phases include validate, compile, test, package, verify, install, deploy.
  2. Use test (not tests), install (not instal), package (not packge).
  3. For a plugin goal, use the prefix:goal form, e.g. dependency:tree.

How to prevent it

  • Standardize the exact mvn command in the workflow file and reuse it.
  • Run mvn -B clean verify in CI to cover compile, test, and packaging.
  • Lint workflow YAML so a typo in the command is caught in review.

Related guides

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