Apache Maven
$ mvn Foundation Med RiskApache Maven (mvn) orchestrates Java/JVM compilation, dependency resolution, packaging, and plugin goals from pom.xml. It provides -B (--batch-mode), --color never, and -o (--offline), though its verbose text logs lack native --json output.
brew install maven mvn compiles JVM bytecode, resolves ~/.m2 artifacts, and runs Surefire/Failsafe test suites locally; MCP servers cannot substitute for local build execution.
Agent-Readiness Checklist
Local Probe EvidenceCaptured --help excerpt
usage: mvn [options] [<goal(s)>] [<phase(s)>]
Options:
-am,--also-make If project list is specified,
also build projects required by
the list
-amd,--also-make-dependents If project list is specified,
also build projects that depend
on projects on the list
-B,--batch-mode Run in non-interactive (batch)
mode (disables output color)
-b,--builder <arg> The id of the build strategy to
use
-C,--strict-checksums Fail the build if checksums don't
match
-c,--lax-checksums Warn if checksums don't match
--color <arg> Defines the color mode of the
output. Supported are 'auto',
'always', 'never'.
-cpu,--check-plugin-updates Ineffective, only kept for
backward compatibility
-D,--define <arg> Define a user property
-e,--errors Produce execution error messages
-emp,--encrypt-master-password <arg> Encrypt master security password
-ep,--encrypt-password <arg> Encrypt server password
-f,--file <arg> Force the use of an alternate POM
file (or directory with pom.xml)
-fae,--fail-at-end Only fail the build afterwards;
allow all non-impacted builds to
continue
-ff,--fail-fast Stop at first failure in
reactorized builds
-fn,--fail-never NEVER fail the build, regardless
of project result
-gs,--global-settings <arg> Alternate path for the global
settings file
-gt,--global-toolchains <arg> Alternate path for the global
toolchains file
-h,--help Display help information
-itr,--ignore-transitive-repositories If set, Mav FCRS-1.0 6-Dimension Breakdown
Supports -B (--batch-mode), -q, --color never, and -o (--offline), but produces verbose unstructured text logs with no --json or global --dry-run.
-B --color neversuppresses prompts and ANSI escapes- No native
--jsonoutput across lifecycle goals
Build outputs stay under target/ and ~/.m2/repository, though mvn lacks a dry-run mode and deploy pushes remote artifacts.
-ooffline mode prevents unexpected network resolution- No global
--dry-runbefore running lifecycle plugins
Cross-platform via Homebrew, SDKMAN, and ./mvnw wrapper across macOS, Linux, and Windows, requiring a JDK.
- Requires compatible JDK installed on host
Standardized JVM build lifecycle and vast plugin ecosystem, though cold JVM startup and verbose [INFO] logs consume context tokens.
- Universal Java build lifecycle; slower incremental builds than Gradle/mvnd
Apache Software Foundation flagship project (apache/maven) under Apache-2.0 license.
- Official Apache Software Foundation repository
Extensive official documentation at maven.apache.org, though plugin-specific goal flags are spread across separate plugin sites.
- Official CLI reference at maven.apache.org
Security, Auth & Guardrails
Public Maven Central needs no auth; private repository credentials and GPG keys are configured in ~/.m2/settings.xml.
Apache-2.0 open-source CLI; free to use.
# Apache Maven (mvn) Agent Rules - Always pass `-B --color never` (and `-q` or `-fae` where appropriate) to avoid prompts and log bloat. - Prefer `./mvnw` if present in the repo, and never run `mvn deploy` without explicit user approval.
Agent-Ready Command Recipes
Safe Read-Only Queries
mvn -B --color never help:effective-pom
Resolves parent POMs, profiles, and properties to inspect the effective build configuration.
mvn -B --color never dependency:tree
Prints transitive Maven dependency resolution without running compile or test phases.
Controlled Writes & Previews
mvn -B -q --color never test
Compiles and executes unit tests non-interactively while suppressing [INFO] progress noise.
Strengths for Agents
- +
-B(--batch-mode) and--color neverguarantee non-interactive, ANSI-free execution. - +
mvn -qtrims noisy[INFO]lines to keep error diagnostics concise for agents. - +
dependency:treeandhelp:effective-pomexpose full transitive build resolution.
Caveats & Pitfalls
- ! No native
--jsonoutput or universal--dry-runflag. - ! Verbose lifecycle logs can flood agent context windows unless
-qor log filtering is used.