Jenkins部署SpringBoot项目,报错:Build step 'Invoke top-level Maven targets' marked build as failure

WARNING] Failed to create parent directories for tracking file /opt/mavenRepository/org/springframework/boot/
spring-boot-starter-parent/2.3.0.RELEASE/spring-boot-starter-parent-2.3.0.RELEASE.pom.lastUpdated
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.gitee:code:1.0-SNAPSHOT: Could not transfer 
artifact org.springframework.boot:spring-boot-starter-parent:pom:2.3.0.RELEASE 
from/to ali (https://maven.aliyun.com/repository/public/): 
/opt/mavenRepository/org/springframework/boot/spring-boot-starter-parent/
2.3.0.RELEASE/spring-boot-starter-parent-2.3.0.RELEASE.pom.part.lock 
(No such file or directory) and 'parent.relativePath' points 
at wrong local POM @ line 15, column 13
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.gitee:code:1.0-SNAPSHOT 
(/var/lib/jenkins/workspace/zblog/code/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.gitee:code:1.0-SNAPSHOT: Could not transfer 
artifact org.springframework.boot:spring-boot-starter-parent:pom:2.3.0.RELEASE from/to 
ali (https://maven.aliyun.com/repository/public/): 
/opt/mavenRepository/org/springframework/boot/spring-boot-starter-parent/
2.3.0.RELEASE/spring-boot-starter-parent-2.3.0.RELEASE.pom.part.lock (No such file 
or directory) and 'parent.relativePath' points at wrong local POM @ line 15, column 13 -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
Build step 'Invoke top-level Maven targets' marked build as failure
[DeployPublisher][INFO] Build failed, project not deployed
Finished: FAILURE

上面错误,大致原因是:

Jenkins没有权限访问maven本地仓库的目录。

解决方案:修改maven本地仓库的访问权限。

我配置的maven本地仓库目录是 '/opt/mavenRepository目录。

注意:根据自己maven中conf目录下的settings.xml文件中,配置的为准。

我的maven安装在Linux服务器上面,所以通过如下命令修改访问权限。

切换到/opt目录下,执行命令:

chmod -R o+r+w mavenRepository

再次执行命令:

chmod o+r+w mavenRepository

执行完成之后,再次到Jenkins中构建项目即可。

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐