Loading published curriculum…

06 · Maven from first build to release / LESSON 26 OF 102

Repositories, profiles, and build troubleshooting

A reproducible build separates project configuration from credentials and machine-specific settings.

Before this lesson: Multi-module projects and dependency direction

Understand the topic

Maven downloads artifacts into a local repository and consults configured remote repositories or mirrors. settings.xml can hold server references and environment-specific configuration. Never commit credentials; use CI secret injection and narrowly scoped publishing permissions.

Profiles can change build inputs, so document their activation. Prefer runtime application configuration for deployment differences rather than rebuilding a different application for every environment. Diagnose offline, authentication, missing-artifact, and test failures separately.

EXAMPLE · SHELL

Terminal

./mvnw help:active-profiles
./mvnw dependency:go-offline
./mvnw -o verify

What to expect

The first command lists active profiles. Offline verification succeeds only if all required artifacts and plugin dependencies are already cached.

YOUR TURN

Put it into practice

  1. 01Perform a clean build with documented settings.
  2. 02Try offline mode after resolving dependencies and record which external inputs remain.
  3. 03Verify: The README names required repositories and variables without containing credentials.

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 reproducible build separates project configuration from credentials and machine-specific settings.

  1. 01Maven downloads artifacts into a local repository and consults configured remote repositories or mirrors. settings.xml can hold server references and environment-specific configuration. Never commit credentials; use CI secret injection and narrowly scoped publishing permissions.
  2. 02Profiles can change build inputs, so document their activation. Prefer runtime application configuration for deployment differences rather than rebuilding a different application for every environment. Diagnose offline, authentication, missing-artifact, and test failures separately.
  3. 03Trace the example: The first command lists active profiles. Offline verification succeeds only if all required artifacts and plugin dependencies are already cached.

A mistake worth avoiding

A build succeeds only on one developer machine.

DEBUGGING ROOM

Something broke. Where do you look?

A build succeeds only on one developer machine.

Before revealing the diagnosis, write down your first investigation step.

CHECK YOUR UNDERSTANDING

Should a repository password be committed in pom.xml?

Choose one answer

BUILD IT YOURSELF

Perform a clean build with documented settings.

  1. 1.Perform a clean build with documented settings.
  2. 2.Try offline mode after resolving dependencies and record which external inputs remain.
  3. 3.Reproduce this failure, then repair it: A build succeeds only on one developer machine.

Acceptance checklist

Lab completion is your self-report. Knowledge checks do not certify project quality.

RETRIEVE IT FROM MEMORY

Should a repository password be committed in pom.xml?

Revisit this lesson in three days after a successful check or lab.

Ready for the next step?

The README names required repositories and variables without containing credentials.

Reading is separate from passing a knowledge check or completing a lab.

Go deeper · official references