• Maven报错Failed to collect dependencies at com.***:***:jar:1.0.0


    问题

    mvn install后报错,使用mvn -X install使用debug模式查看,显示如下信息,意思是这个jar包的依赖包下载不到。

    解决办法

    添加仓库即可,可以去setting中添加mirror或profile下的repository,同时需要用activeProfiles激活profile。

    去maven的setting中修改mirrors

            <mirror>
                <id>alimaven</id>
                <name>aliyun maven</name>
                <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                <mirrorOf>central</mirrorOf>
            </mirror>
            <mirror>
                <id>uk</id>
                <mirrorOf>central</mirrorOf>
                <name>Human Readable Name for this Mirror.</name>
                <url>http://uk.maven.org/maven2/</url>
            </mirror>
            <mirror>
                <id>CN</id>
                <name>OSChina Central</name>
                <url>http://maven.oschina.net/content/groups/public/</url>
                <mirrorOf>central</mirrorOf>
            </mirror>
            <mirror>
                <id>nexus</id>
                <name>internal nexus repository</name>
                <!-- <url>http://192.168.1.100:8081/nexus/content/groups/public/</url>-->
                <url>http://repo.maven.apache.org/maven2</url>
                <mirrorOf>central</mirrorOf>
            </mirror>

    用profile,同时需要密码的记得配置server,id要一致

    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                          http://maven.apache.org/xsd/settings-1.0.0.xsd">
      <!-- 读取mvn库用,选择要激活的profile -->
      <activeProfiles>
        <activeProfile>github</activeProfile>
      </activeProfiles>
      <!-- 读取mvn库用,配置一系列profile,一定要写到具体仓库 -->
      <profiles>
        <profile>
          <id>github</id>
          <repositories>
            <repository>
              <id>github</id>
              <name>GitHub AutKevin Apache Maven Packages</name>
              <url>https://maven.pkg.github.com/AutKevin/maven-repo</url>
            </repository>
          </repositories>
        </profile>
      </profiles>
      <!-- 上面两项也可以不配置,只不过每次都要在pom.xml文件中配置,这里配置可以一劳永逸 -->
    </settings>
     
  • 相关阅读:
    Django 初试水(一)
    自己动手系列----使用数组实现一个简单的Set
    自己动手系列----使用数组实现一个简单的Map
    DB2中的MQT优化机制详解和实践
    Airy Memory 内存清理 + 注册码
    eclipse 工具翻译插件安装
    用sysdba登录oracle 11g数据库时遇到已连接到空闲例程 ora-013113
    Firewall 防火墙规则
    未找到段的定义
    ORACLE 锁表的解决方法 ORA-00054
  • 原文地址:https://www.cnblogs.com/aeolian/p/12468493.html
Copyright © 2020-2023  润新知