1 测试maven 是否已经安装成功

mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T07:57:3

7-04:00)

Maven home: C:\apache-maven-3.3.3\bin\..

Java version: 1.7.0_75, vendor: Oracle Corporation

Java home: C:\Java\jdk1.7.0_75\jre

Default locale: en_US, platform encoding: Cp1252

OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

如果现实上述信息证明安装成功。

 

2 找出当前maven settings.xml 和 仓库的位置 

如果你有多个settings.xml 但是不清楚当前maven 是读取哪个 可以执行如下指令

默认仓库位置 $uer.home/.m2

 

mvn -X

        ...
        ...
 [DEBUG] Reading global settings from C:\apache-maven-3.3.3\bin\..\conf\settings.

xml

[DEBUG] Reading user settings from C:\Users\jian_j\.m2\settings.xml

[DEBUG] Reading global toolchains from C:\apache-maven-3.3.3\bin\..\conf\toolcha

ins.xml

[DEBUG] Reading user toolchains from C:\Users\jian_j\.m2\toolchains.xml

[DEBUG] Using local repository at C:\maven_repo

[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\m

aven_repo

 通过上述信息可以查看出是读取哪个settings.xml 并且知道当前仓库local repo 的位置

 

3 设置自定义仓库位置

找到settings.xml 修改localRepository

<
settings
>

  
<!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ~/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->


<
localRepository
>
才:/maven_repo
</
localRepository
>