zoukankan      html  css  js  c++  java
  • 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>
     
  • 相关阅读:
    学习Linux二(创建、删除文件和文件夹命令)
    合理的需求
    两种事件触发的jquery导航菜单
    JS中this关键字
    Hibernate的session问题
    JQUERY图片特效
    学习Linux一(安装VMware和Ubuntu)
    A标签跳转问题
    WEBSERVICE简介
    IE下设置Cursor的一点记录
  • 原文地址:https://www.cnblogs.com/aeolian/p/12468493.html
Copyright © 2011-2022 走看看