码迷,mamicode.com
首页 > 其他好文 > 详细

Idea Maven配置镜像地址总出问题,麻烦检查一下这里!(最新)

时间:2020-02-25 18:16:33      阅读:65      评论:0      收藏:0      [点我收藏+]

标签:path   encoding   line   provider   finish   配置文件   要求   uil   OWIN   

关注点赞,养成习惯。
留言交流,成长你我。

一、问题追溯

笔者使用idea, 采用Maven去下载依赖包,总是下载不成功。我检查了地址,也更换成阿里镜像的地址,但还是很多冒红波浪线的包没下载。 经查阅各种资料,各种尝试,无解。

先看一下问题截图
技术图片

看到这么多红波浪线,是不是很头大。

有人说,可以更换阿里Maven镜像啊,我配置不止一个,很多个,但就是不管用。

我原始配置Maven的settings.xml如下:

<?xml version="1.0" encoding="UTF-8"?>
<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">
    <mirrors>
        <mirror>
      <id>nexus-aliyun</id>
      <mirrorOf>*</mirrorOf>
      <name>Nexus aliyun</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>

    <mirror>
      <id>repo1</id>
      <mirrorOf>central</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://repo1.maven.org/maven2/</url>
    </mirror>


    <mirror>
      <id>repo2</id>
      <mirrorOf>central</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://repo2.maven.org/maven2/</url>
    </mirror>

    <mirror>
      <id>alimaven</id>
      <mirrorOf>central</mirrorOf>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
    </mirror>
    </mirrors>
</settings>

看了上面的配置,是不是没发现什么问题呢。

又有人说,需要找到下载失败的包删除,重新 maven import操作。好吧,我也尝试过很多遍,还是没下载成功。

下面重点来了,
下面重点来了,
下面重点来了,

我在执行maven install, 看到运行日志,找到有这样的一行报错信息

D:\tools\Java\jdk1.8.0_151\bin\java.exe -Dmaven.multiModuleProjectDirectory=E:\fanglei\java\jpress "-Dmaven.home=D:\Program Files\JetBrains\IntelliJ IDEA 2019.1\plugins\maven\lib\maven3" "-Dclassworlds.conf=D:\Program Files\JetBrains\IntelliJ IDEA 2019.1\plugins\maven\lib\maven3\bin\m2.conf" "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2019.1\lib\idea_rt.jar=60913:D:\Program Files\JetBrains\IntelliJ IDEA 2019.1\bin" -Dfile.encoding=GBK -classpath "D:\Program Files\JetBrains\IntelliJ IDEA 2019.1\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version2019.1 -s C:\Users\fl\.m2\settings.xml install
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for io.jpress:starter-tomcat:war:3.0
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-war-plugin is missing. @ io.jpress:starter-tomcat:[unknown-version], E:\fanglei\java\jpress\starter-tomcat\pom.xml, line 250, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-resources-plugin is missing. @ io.jpress:starter-tomcat:[unknown-version], E:\fanglei\java\jpress\starter-tomcat\pom.xml, line 215, column 21
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] parent
[INFO] codegen
[INFO] jpress-commons
[INFO] jpress-model
[INFO] jpress-service-api
[INFO] jpress-core
[INFO] jpress-addons
[INFO] jpress-addon-helloworld
[INFO] jpress-web
[INFO] jpress-service-provider
[INFO] jpress-template
[INFO] module-article
[INFO] module-article-model
[INFO] module-article-service-api
[INFO] module-article-search-api
[INFO] module-article-search-db
[INFO] module-article-search-lucene
[INFO] module-article-search-es
[INFO] module-article-search-opensearch
[INFO] module-article-service-provider
[INFO] module-article-web
[INFO] module-page
[INFO] module-page-model
[INFO] module-page-service-api
[INFO] module-page-service-provider
[INFO] module-page-web
[INFO] module-product
[INFO] module-product-model
[INFO] module-product-service-api
[INFO] module-product-search-api
[INFO] module-product-search-db
[INFO] module-product-search-lucene
[INFO] module-product-search-es
[INFO] module-product-search-opensearch
[INFO] module-product-service-provider
[INFO] module-product-web
[INFO] starter
[INFO] starter-tomcat
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building parent 3.0
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] parent ............................................. FAILURE [  1.449 s]
[INFO] codegen ............................................ SKIPPED
[INFO] jpress-commons ..................................... SKIPPED
[INFO] jpress-model ....................................... SKIPPED
[INFO] jpress-service-api ................................. SKIPPED
[INFO] jpress-core ........................................ SKIPPED
[INFO] jpress-addons ...................................... SKIPPED
[INFO] jpress-addon-helloworld ............................ SKIPPED
[INFO] jpress-web ......................................... SKIPPED
[INFO] jpress-service-provider ............................ SKIPPED
[INFO] jpress-template .................................... SKIPPED
[INFO] module-article ..................................... SKIPPED
[INFO] module-article-model ............................... SKIPPED
[INFO] module-article-service-api ......................... SKIPPED
[INFO] module-article-search-api .......................... SKIPPED
[INFO] module-article-search-db ........................... SKIPPED
[INFO] module-article-search-lucene ....................... SKIPPED
[INFO] module-article-search-es ........................... SKIPPED
[INFO] module-article-search-opensearch ................... SKIPPED
[INFO] module-article-service-provider .................... SKIPPED
[INFO] module-article-web ................................. SKIPPED
[INFO] module-page ........................................ SKIPPED
[INFO] module-page-model .................................. SKIPPED
[INFO] module-page-service-api ............................ SKIPPED
[INFO] module-page-service-provider ....................... SKIPPED
[INFO] module-page-web .................................... SKIPPED
[INFO] module-product ..................................... SKIPPED
[INFO] module-product-model ............................... SKIPPED
[INFO] module-product-service-api ......................... SKIPPED
[INFO] module-product-search-api .......................... SKIPPED
[INFO] module-product-search-db ........................... SKIPPED
[INFO] module-product-search-lucene ....................... SKIPPED
[INFO] module-product-search-es ........................... SKIPPED
[INFO] module-product-search-opensearch ................... SKIPPED
[INFO] module-product-service-provider .................... SKIPPED
[INFO] module-product-web ................................. SKIPPED
[INFO] starter ............................................ SKIPPED
[INFO] starter-tomcat ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.735 s
[INFO] Finished at: 2020-02-25T15:55:37+08:00
[INFO] Final Memory: 13M/307M
[INFO] ------------------------------------------------------------------------
(start 重要:这一行报错信息提示)
[ERROR] Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.4: 
Could not transfer artifact org.apache.maven.plugins:maven-install-plugin:pom:2.4 
from/to repo1 (http://repo1.maven.org/maven2/): Failed to transfer file: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom.
 Return code is: 501, ReasonPhrase: HTTPS Required. -> [Help 1] 
(end 重要:这一行报错信息提示)
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

Process finished with exit code 1

从上面我们可以直接看到,该报错信息Return code is: 501, ReasonPhrase: HTTPS Required,是因为中央库的地址现在要求HTTPS才能请求成功。

那么我们找到问题根源,是不是就可以很快速的去解决。

二、解决之道

解决之法:需要把原来的http协议换成https协议

提供一份最新可用的maven的settings.xml配置文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<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">
    <mirrors>
        <mirror>
      <id>nexus-aliyun</id>
      <mirrorOf>*</mirrorOf>
      <name>Nexus aliyun</name>
      <url>https://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>

    <mirror>
      <id>repo1</id>
      <mirrorOf>central</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>https://repo1.maven.org/maven2/</url>
    </mirror>


    <mirror>
      <id>repo2</id>
      <mirrorOf>central</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>https://repo2.maven.org/maven2/</url>
    </mirror>

    <mirror>
      <id>alimaven</id>
      <mirrorOf>central</mirrorOf>
      <name>aliyun maven</name>
      <url>https://maven.aliyun.com/nexus/content/repositories/central/</url>
    </mirror>
    </mirrors>
</settings>

看阿里的镜像库都换成https:// , 不是现在很多网上查阅的资料是以http://
技术图片

建议大家也检查一下,配置的地址是否是以https协议开头的,建议更换。

技术图片

Idea Maven配置镜像地址总出问题,麻烦检查一下这里!(最新)

标签:path   encoding   line   provider   finish   配置文件   要求   uil   OWIN   

原文地址:https://www.cnblogs.com/werewolfBoy/p/12362439.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!