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

问题

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

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

 

解决办法

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

去maven的setting中修改mirrors

        <mirror>
            <id>alimavenid>
            <name>aliyun mavenname>
            <url>http://maven.aliyun.com/nexus/content/groups/public/url>
            <mirrorOf>centralmirrorOf>
        mirror>
        <mirror>
            <id>ukid>
            <mirrorOf>centralmirrorOf>
            <name>Human Readable Name for this Mirror.name>
            <url>http://uk.maven.org/maven2/url>
        mirror>
        <mirror>
            <id>CNid>
            <name>OSChina Centralname>
            <url>http://maven.oschina.net/content/groups/public/url>
            <mirrorOf>centralmirrorOf>
        mirror>
        <mirror>
            <id>nexusid>
            <name>internal nexus repositoryname>
            
            <url>http://repo.maven.apache.org/maven2url>
            <mirrorOf>centralmirrorOf>
        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">
  
  <activeProfiles>
    <activeProfile>githubactiveProfile>
  activeProfiles>
  
  <profiles>
    <profile>
      <id>githubid>
      <repositories>
        <repository>
          <id>githubid>
          <name>GitHub AutKevin Apache Maven Packagesname>
          <url>https://maven.pkg.github.com/AutKevin/maven-repourl>
        repository>
      repositories>
    profile>
  profiles>
  
settings>

 

 

 

 

 

 

 
点赞

Leave a Reply

Your email address will not be published. Required fields are marked *