failed: Connection timed out: connect and 'parent.relativePath' points at no local POM

一、问题背景

需要部署一个spring-boot项目,整个项目后台为Jar包打包方式,在用idea打包生成环境prod时遇到报错信息:

D:\Tool_install\JDK\bin\java.exe "-Dmaven.multiModuleProjectDirectory=E:\idea workspace1\irrigated-area" -Dmaven.home=D:\Tool_install\apache-maven-3.3.9 -Dclassworlds.conf=D:\Tool_install\apache-maven-3.3.9\bin\m2.conf "-javaagent:D:\Tool_install\IntelliJ\IntelliJ IDEA 2018.1.8\lib\idea_rt.jar=56216:D:\Tool_install\IntelliJ\IntelliJ IDEA 2018.1.8\bin" -Dfile.encoding=UTF-8 -classpath D:\Tool_install\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2018.1.8 clean install -Pprod -U -Dmaven.test.skip=true
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.1.3.RELEASE/spring-boot-starter-parent-2.1.3.RELEASE.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.hnac:irrigated-area:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.3.RELEASE from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.24.215] failed: Connection timed out: connect and 'parent.relativePath' points at no local POM @ line 5, column 11
 @ 
[ERROR] The build could not read 1 project -> [Help 1]

 

运行命令mvn clean install -Pprod -U -Dmaven.test.skip=true

 

二、问题分析

1、刚开始关注点为:https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.1.3.RELEASE/spring-boot-starter-parent-2.1.3.RELEASE.pom 为何无法下载,于是上私服查看,发现有此文件,

然后查看本地仓库也已经下载,但是没有JAR包,后来发现此文件的打包方式为pom方式:

failed: Connection timed out: connect and 'parent.relativePath' points at no local POM_第1张图片

 

2、问题点转义,分析'parent.relativePath'

failed: Connection timed out: connect and 'parent.relativePath' points at no local POM_第2张图片

一番搜索查找之后,发现relativePath属性默认不配置,就如其后面的注释说明,会从仓库中找依赖,无问题。

 

3、又回到刚开始的疑问,为什么这个下载地址显示的不是私服,仔细检查maven SDK配置,已经是配置私服。

回想开发环境的运行时正常的,于是怀疑是否为运行命令的mvn配置不是用的自己设置的配置,咨询同事,一般运行命令在右侧:
failed: Connection timed out: connect and 'parent.relativePath' points at no local POM_第3张图片

此处尝试正常打包JAR,查看运行命令结果:

D:\Tool_install\JDK\bin\java.exe "-Dmaven.multiModuleProjectDirectory=E:\idea workspace1\irrigated-area" -Dmaven.home=D:\Tool_install\apache-maven-3.3.9 -Dclassworlds.conf=D:\Tool_install\apache-maven-3.3.9\bin\m2.conf "-javaagent:D:\Tool_install\IntelliJ\IntelliJ IDEA 2018.1.8\lib\idea_rt.jar=59636:D:\Tool_install\IntelliJ\IntelliJ IDEA 2018.1.8\bin" -Dfile.encoding=UTF-8 -classpath D:\Tool_install\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2018.1.8 -s D:\Tool_install\apache-maven-3.3.9\settings.xml -Dmaven.repo.local=D:\Maven\hnac_respository1 -DskipTests=true install -f pom.xml -P prod
[INFO] Scanning for projects..

 

果然多了一个-s 的参数设置配置文件。

参数参考:https://www.cnblogs.com/zhaoyan001/p/8735196.html

 

而自己的运行命令位置为:
failed: Connection timed out: connect and 'parent.relativePath' points at no local POM_第4张图片

默认配置位置不详,此坑踩踏一下午,mark一下,免得再犯.....

你可能感兴趣的:(后端)