Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Maven CLI Options Reference: Practical Flags, Comparisons, and Command Examples

Maven CLI flags control what gets built, how failures are handled, and how dependencies are resolved. This reference is for developers, build engineers, and CI maintainers who want faster, more predictable Maven runs and a quick way to pick the right options.

Originally published on 2013-09-12; fully revised and updated.

Original article: Maven commands Web References & Cheatsheet.

Maven CLI options reference image from the original post

Maven CLI decision flow for day-to-day builds

flowchart TD
    A[Start with mvn goal] --> B{Need partial reactor build}
    B -- Yes --> C[Use -pl with -am or -amd]
    B -- No --> D[Build full reactor]
    C --> E{Previous run failed}
    D --> E
    E -- Yes --> F[Resume with -rf]
    E -- No --> G[Choose failure policy]
    F --> G
    G --> H{Fast feedback needed}
    H -- Yes --> I[Use -ff and maybe -T]
    H -- No --> J[Use -fae]
    I --> K[Run in CI with -B and -V]
    J --> K
    K --> L{Need fresh dependencies}
    L -- Yes --> M[Use -U]
    L -- No --> N[Use -o or -nsu]

High-value Maven options by category

CategoryOptionsWhat they controlTypical use
Reactor scope-pl, -am, -amd, -rf, -NWhich modules are built and where a build resumesMonorepos and multi-module builds
Failure behavior-ff, -fae, -fnWhen Maven stops or continues after errorsFast local feedback or full CI failure reporting
Dependency freshness-U, -nsu, -oWhether Maven checks remotes or stays offlineSnapshot troubleshooting, reproducible offline runs
Output and diagnostics-q, -e, -X, -l, -VHow much logging is produced and where it goesCI logs, debugging flaky builds
Environment files-s, -gs, -t, -fAlternate settings, toolchains, and POM pathPer-environment and per-pipeline customization
Automation and performance-B, -T, -DBatch mode, threading, and system propertiesNon-interactive CI with controlled tuning

Option comparisons that change build outcomes

GoalPreferAlternativeTrade-off
Stop immediately on first failure-ff / --fail-fast-fae / --fail-at-endFast signal, but fewer downstream failures discovered in one run
Run all modules and report failures at the end-fae / --fail-at-end-ff / --fail-fastMore complete failure picture, potentially longer runtime
Never fail process exit-fn / --fail-never-fae or -ffUseful for diagnostics only; risky for release gates
Enforce artifact integrity strictly-C / --strict-checksums-c / --lax-checksumsStrict mode is safer; lax mode may hide repository issues
Run with no network dependency checks-o / --offline-nsu / --no-snapshot-updatesOffline is most reproducible; no-snapshot-updates still allows non-snapshot remote interactions
Force fresh remote metadata/artifacts-U / --update-snapshotsDefault update behaviorCan fix stale cache issues but may increase build time

Practical command examples

Use these as starting points and adapt goals/phases to your pipeline.

mvn -B -V -e -T 1C clean verify

Build one module plus required upstream modules:

mvn -pl :api-service -am testCode language: CSS (css)

Resume a failed multi-module run from a specific module:

mvn -rf :payments-service verifyCode language: CSS (css)

Force remote snapshot/release checks when debugging stale artifacts:

mvn -U clean package

Use alternate settings and toolchains in CI:

mvn -s ~/.m2/settings-ci.xml -t ~/.m2/toolchains.xml deployCode language: JavaScript (javascript)

Capture all output to a log file for post-run analysis:

mvn -l build.log clean installCode language: CSS (css)

Complete CLI options reference from the original post

OptionDescription
-am, --also-makeIf a project list is specified, also build projects required by that list.
-amd, --also-make-dependentsIf a project list is specified, also build projects that depend on projects in that list.
-B, --batch-modeRun in non-interactive batch mode.
-C, --strict-checksumsFail the build if checksums do not match.
-c, --lax-checksumsWarn if checksums do not match.
-cpu, --check-plugin-updatesIneffective; kept for backward compatibility.
-D, --define <arg>Define a system property.
-e, --errorsProduce execution error messages.
-emp, --encrypt-master-password <arg>Encrypt master security password.
-ep, --encrypt-password <arg>Encrypt server password.
-f, --file <arg>Force use of an alternate POM file (or a directory with pom.xml).
-fae, --fail-at-endOnly fail at the end; allow all non-impacted builds to continue.
-ff, --fail-fastStop at first failure in reactor builds.
-fn, --fail-neverNever fail the build, regardless of project result.
-gs, --global-settings <arg>Alternate path for the global settings file.
-h, --helpDisplay help information.
-l, --log-file <arg>Write all build output to a log file.
-llr, --legacy-local-repositoryUse Maven 2 legacy local repository behavior (no _maven.repositories). Can also be activated with -Dmaven.legacyLocalRepo=true.
-N, --non-recursiveDo not recurse into sub-projects.
-npr, --no-plugin-registryIneffective; kept for backward compatibility.
-npu, --no-plugin-updatesIneffective; kept for backward compatibility.
-nsu, --no-snapshot-updatesSuppress SNAPSHOT updates.
-o, --offlineWork offline.
-P, --activate-profiles <arg>Comma-delimited list of profiles to activate.
-pl, --projects <arg>Comma-delimited list of reactor projects to build instead of all projects. A project can be specified by [groupId]:artifactId or by relative path.
-q, --quietQuiet output; show errors only.
-rf, --resume-from <arg>Resume reactor from a specified project.
-s, --settings <arg>Alternate path for the user settings file.
-T, --threads <arg>Thread count, for example 2.0C where C multiplies available cores.
-t, --toolchains <arg>Alternate path for the user toolchains file.
-U, --update-snapshotsForce a check for updated releases and snapshots on remote repositories.
-up, --update-pluginsIneffective; kept for backward compatibility.
-V, --show-versionDisplay version information without stopping the build.
-v, --versionDisplay version information.
-X, --debugProduce execution debug output.

Best practices

  • In CI, prefer -B and include -V so logs always show the Maven version used.
  • Use -ff for fast developer feedback, and -fae when you need a full failure report across modules.
  • Use -U selectively while troubleshooting cache or snapshot issues; avoid it by default if build speed is critical.
  • Pin environment-specific behavior with -s, -gs, and -t instead of relying on implicit local defaults.
  • Avoid -fn in release or gating pipelines because it can mask real failures.
  • Verify option support in your installed Maven using mvn -h, especially for flags marked as backward-compatibility only.

The original page also included a broken YouTube embed; the fallback link visible on that page points to: https://www.youtube.com/watch?v=ZCfrNvu6nMc.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Maven Learning Resources: A Practical Study Plan with the Better Builds with Maven PDF

The original post shared one Maven book link. This revised guide preserves that resource and adds a practical learning workflow, comparison table, and hands-on Maven commands.

Read More

Maven2 Web Application Setup: Legacy Step-by-Step Guide with Build, Jetty, and Site Reporting

A practical Maven2-era walkthrough for creating a Java web app, running core build goals, and generating docs and reports from pom.xml. This revision keeps the original workflow but adds structure, comparisons, and implementation-ready snippets.

Read More

Maven Clover for Distributed Java Applications: Instrument, Collect, and Aggregate Coverage

Learn a practical Clover + Maven workflow for distributed test environments. This walkthrough covers instrumentation, remote execution, coverage file collection, and final report generation.

Read More

Maven Reporting Plugins: Configure Site Reports in pom.xml (All, Selective, and reportSets)

Maven reporting plugins generate project documentation during the site lifecycle and are configured in the reporting section of pom.xml. This guide shows how to run all reports, select specific ones, and structure reportSets cleanly.

Read More

Maven Properties Reference: project.*, settings.*, env.*, and Custom POM Values

Maven properties are the backbone of reusable, environment-aware builds. This revised reference explains major property sources, interpolation flow, and practical commands for inspecting real values.

Read More

Maven Profiles in Practice: Definition, Activation, and Reliable Multi-Environment Builds

Maven profiles let you customize one build for multiple environments without cloning POM files. This guide covers profile types, activation methods, CLI usage, and team-safe best practices.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x