其他分享
首页 > 其他分享> > Maven报错:Downloading from central: https://repo.maven.apache.org/maven2/

Maven报错:Downloading from central: https://repo.maven.apache.org/maven2/

作者:互联网

今天用Maven跑项目时,遇到这样的问题:

Downloading from central: https://repo.maven.apache.org/maven2/…

原因:

所有自定义pom.xml都是继承自super pom,spuper pom中有如下内容:

<repositories>
    <repository>
      <id>central</id>
      <name>Central Repository</name>
      <url>http://repo.maven.apache.org/maven2</url>
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>
 
  <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <name>Central Repository</name>
      <url>http://repo.maven.apache.org/maven2</url>
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
    </pluginRepository>
  </pluginRepositories>
故当maven下载资源时,会优先使用http://repo.maven.apache.org/maven2去下载。

解决方法:

在项目pom.xml的中添加:

<repositories>
    <repository>
        <id>alimaven</id>
        <url>https://maven.aliyun.com/repository/public</url>
    </repository>
</repositories>
 
<pluginRepositories>
    <pluginRepository>
        <id>alimaven</id>
        <url>https://maven.aliyun.com/repository/public</url>
    </pluginRepository>
</pluginRepositories>

转自:Maven报错:Downloading from central: https://repo.maven.apache.org/maven2/

标签:maven,Downloading,maven2,repo,报错,https,apache,org
来源: https://blog.csdn.net/God__is__a__girl/article/details/120112150