Loading
0

maven的settings.xml配置文件

maven会自动读取用户主目录下的.m2隐藏目录中的settings.xml文件,没有的话从maven的配置目录可以拷贝一份过去,通常用它来干啥?

用来指定本地仓库目录的位置:

<localRepository>D:/maven/repository</localRepository>

指定maven的仓库镜像服务器,比将中央仓库换成阿里云的镜像:

<mirror>
  <id>aliyun-maven</id>
  <mirrorOf>central</mirrorOf>
  <url>https://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

或者:

<mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf> 
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </mirror>
    <mirror>
      <id>nexus-public-snapshots</id>
      <mirrorOf>public-snapshots</mirrorOf>
      <url>http://maven.aliyun.com/nexus/content/repositories/snapshots/</url>
</mirror>

对于需要授权的服务器,设置用户名和密码:

<server>
  <id>ossh</id>
  <username>your name</username>
  <password>your password</password>
</server>

参考:

最后编辑于:2021/8/2作者: joycode

我不入地狱,谁入地狱?

评论已关闭