Maven in 5 Minutes

安装:java环境

额外配置
You can specify your user configuration in ${user.home}/.m2/settings.xml. A full reference to the configuration file is available. This section will show how to make some common configurations. Note that the file is not required - defaults will be used if it is not found.

修改本地Repo的目录:
The location of your local repository can be changed in your user configuration. The default value is ${user.home}/.m2/repository/.

<settings>
  ...
  <localRepository>/path/to/local/repo/</localRepository>
  ...
</settings>

Note: The local repository must be an absolute path.
配置代理
配置组件的并发现在数
By default, Maven 2.1.0+ will download up to 5 artifacts (from different groups) at once. To change the size of the thread pool, start Maven using -Dmaven.artifact.threads. For example, to only download single artifacts at a time:

mvn -Dmaven.artifact.threads=1 clean install

You may wish to set this option permanently, in which case you can use the MAVEN_OPTS environment variable. For example:

export MAVEN_OPTS=-Dmaven.artifact.threads=3
使用镜像Repo
<settings>
  ...
  <mirrors>
    <mirror>
      <id>UK</id>
      <name>UK Central</name>
      <url>http://uk.maven.org/maven2</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>
  ...
</settings>

Maven1下好像不起作用,有时间再试了
控制Maven的日志级别
maven - E jar( 注意大小写)
如果你想控制Maven的日志级别,你可以使用下面三个命令行选项:
-e, --errors 产生执行错误相关消息
-X, --debug 产生执行调试信息
-q, --quiet 仅仅显示错误
只有出现错误或问题,-q 选项才打印一条消息。-X 选项会打印大量的调试日志消息,这个选项主要被Maven开发者和Maven插件开发者用来诊断在开发过程中碰到的Maven代码问题。如果你想诊断依赖或路径问题,-X 选项也非常有用。如果你是Maven开发者,或者你需要诊断Maven插件的一个错误,那么-e选项就会派上用场。如果你想报告Maven或Maven插件的一个未预料到的问题,你应该传递-X 和 -e命令行选项。

你可能感兴趣的:(maven)