Deprecated: Optional parameter $keys declared before required parameter $cms_id is implicitly treated as a required parameter in /home/www/dev/work/class/blog/CmsKey.php on line 75

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\main::$outlink is deprecated in /home/www/dev/work/website/lvesu/template/blog/cms/cms.tpl on line 2

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\main::$status is deprecated in /home/www/dev/work/website/lvesu/template/blog/index.head.php on line 2
Maven报错:Downloading from central: https://repo.maven.apache.org/maven2/ - 互联网笔记

略微加速

略速 - 互联网笔记

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

2021-12-31 leiting (2632阅读)

标签 JAVA

今天用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的<project>中添加:

<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>
北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3