06 · Maven from first build to release / LESSON 20 OF 102
Lifecycle phases versus plugin goals
A phase describes a build stage; plugins supply the executable goals attached to it.
Before this lesson: POM structure, coordinates, and project layout
Understand the topic
The default lifecycle runs earlier phases before the requested phase. verify includes compilation, tests, packaging, and configured verification steps. clean is a separate lifecycle that removes build output. install copies the artifact to the local repository; deploy publishes it to a configured remote repository.
A direct plugin goal such as dependency:tree is different from a lifecycle phase. Do not assume invoking one goal runs earlier build stages. Read build logs in execution order to find which plugin actually failed.
EXAMPLE · SHELL
Terminal
./mvnw clean verify
./mvnw dependency:tree
./mvnw help:describe -Dcmd=verifyWhat to expect
The first command performs a fresh verification build; the second inspects dependencies without promising a full build.
YOUR TURN
Put it into practice
- 01Record the plugins executed by test, package, and verify.
- 02Introduce a failing test and compare each command with a direct dependency goal.
- 03Verify: You can identify the first failed goal and explain why deploy is not needed to run locally.
Pass a quiz or complete a lab to check today’s streak. Each lesson counts once per day, including when you review it later.
UNDER THE HOOD
Build the mental model
A phase describes a build stage; plugins supply the executable goals attached to it.
- 01The default lifecycle runs earlier phases before the requested phase. verify includes compilation, tests, packaging, and configured verification steps. clean is a separate lifecycle that removes build output. install copies the artifact to the local repository; deploy publishes it to a configured remote repository.
- 02A direct plugin goal such as dependency:tree is different from a lifecycle phase. Do not assume invoking one goal runs earlier build stages. Read build logs in execution order to find which plugin actually failed.
- 03Trace the example: The first command performs a fresh verification build; the second inspects dependencies without promising a full build.
A mistake worth avoiding
A JAR exists even though integration verification failed.
DEBUGGING ROOM
Something broke. Where do you look?
A JAR exists even though integration verification failed.
Before revealing the diagnosis, write down your first investigation step.
CHECK YOUR UNDERSTANDING
Does verify normally run phases before verify?
BUILD IT YOURSELF
Record the plugins executed by test, package, and verify.
- 1.Record the plugins executed by test, package, and verify.
- 2.Introduce a failing test and compare each command with a direct dependency goal.
- 3.Reproduce this failure, then repair it: A JAR exists even though integration verification failed.
Acceptance checklist
Lab completion is your self-report. Knowledge checks do not certify project quality.
RETRIEVE IT FROM MEMORY
Does verify normally run phases before verify?
Revisit this lesson in three days after a successful check or lab.
Ready for the next step?
You can identify the first failed goal and explain why deploy is not needed to run locally.
Reading is separate from passing a knowledge check or completing a lab.