下载和安装 Maven 2

根据下列步骤下载和安装 Maven 2:

从 Maven 项目的官方站点下载 Maven 2 二进制文件(参见 参考资料)。

将二进制发布文件解压到选定的目录。

将 InstallationDirectory\bin 目录添加到 PATH 环境变量。

为检验安装,键入 mvn -help 命令。您将看到清单 3 中的帮助页面。

清单 3. 使用 mvn -help 命令检验安装

[code]C:>mvn -help

usage: mvn [options] [<goal(s)>] [<phase(s)>]

Options:
-C,–strict-checksums Fail the build if checksums don’t match
-c,–lax-checksums Warn if checksums don’t match
-P,–activate-profiles Comma-delimited list of profiles to
activate
-ff,–fail-fast Stop at first failure in reactorized builds
-fae,–fail-at-end Only fail the build afterwards; allow all
non-impacted builds to continue
-B,–batch-mode Run in non-interactive (batch) mode
-fn,–fail-never NEVER fail the build, regardless of project
result
-up,–update-plugins Synonym for cpu
-N,–non-recursive Do not recurse into sub-projects
-npr,–no-plugin-registry Don’t use ~/.m2/plugin-registry.xml for
plugin versions
-U,–update-snapshots Update all snapshots regardless of
repository policies
-cpu,–check-plugin-updates Force upToDate check for any relevant
registered plugins
-npu,–no-plugin-updates Suppress upToDate check for any relevant
registered plugins
-D,–define Define a system property
-X,–debug Produce execution debug output
-e,–errors Produce execution error messages
-f,–file Force the use of an alternate POM file.
-h,–help Display help information
-o,–offline Work offline
-r,–reactor Execute goals for project found in the
reactor
-s,–settings Alternate path for the user settings file
-v,–version Display version information[/code]