david2tdw / blog

学习记录
1 stars 1 forks source link

[maven] maven相关 #194

Open david2tdw opened 3 years ago

david2tdw commented 3 years ago

设置maven库:

修改maven的settings.xml,添加镜像配置

<mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
     <mirror>
        <id>nexus-aliyun</id>
        <mirrorOf>central</mirrorOf>
        <name>Nexus aliyun</name>
        <url>https://maven.aliyun.com/repository/public</url>
     </mirror>
  </mirrors>

阿里云 - maven 配置指南

david2tdw commented 3 years ago

一、settings.xml文件会在两个目录下存在:

1、Maven安装目录(全局):%MAVEN_HOME%\conf\settings.xml

2、用户安装目录(用户):${user.home}.m2\settings.xml

第一个是全局配置,第二个是用户配置。当两者都存在,它们的内容将被合并,特定于用户的settings.xml文件占主导地位。

Maven settings.xml配置(指定本地仓库、阿里云镜像设置)

david2tdw commented 3 years ago

settings.xml中设置本地库地址:

<localRepository>D:\maven-repository</localRepository>
david2tdw commented 3 years ago

maven查看依赖关系:

mvn dependency:tree

彻底解决SLF4J: Class path contains multiple SLF4J bindings.