解决Jekins打包报错Failed to execute goal....

tech2023-12-03  37

报错信息

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.5.RELEASE:repackage (repackage) on project ndc172: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.2.5.RELEASE:repackage failed: Plugin org.springframework.boot:spring-boot-maven-plugin:2.2.5.RELEASE or one of its dependencies could not be resolved: Failed to collect dependencies at org.springframework.boot:spring-boot-maven-plugin:jar:2.2.5.RELEASE -> org.springframework.boot:spring-boot-loader-tools:jar:2.2.5.RELEASE: Failed to read artifact descriptor for org.springframework.boot:spring-boot-loader-tools:jar:2.2.5.RELEASE: Could not transfer artifact org.springframework.boot:spring-boot-loader-tools:pom:2.2.5.RELEASE from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.196.215] failed: Connection timed out: connect -> [Help 1] [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

问题分析

由于近期公司内部maven仓库关了,而Jekins部署的服务器只能访问内网,于是导致了上述问题。外网访问不了那就把依赖先下载下来然后上传到jekins服务器即可。

 

解决过程

1.上传相关依赖到Jekins服务器,随便找一个目录存放即可(这里我放在了C:\.m2\repository)

2.修改Jekins编译环境配置,maven编译指令添加参数 -Dmaven.repo.local=C:\.m2\repository(等号后面是刚才依赖上传到的目录)

3.正常情况下完成上述两个步骤就可以了。但是今天遇到了一个新问题,上传之后明明本地已经有依赖了,maven还是一直去远程仓库下载依赖。所以我把所有C:\.m2\repository下所有的_remote.repositories文件全部剪切,丢进垃圾桶。

再回到Jekins重新Build一下。

最新回复(0)