使用jenins部署java项目时报错maven相关

出现错误信息如下:

Waiting for Jenkins to finish collecting data
14:10:47 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean (default-clean) on project ruoyi: Failed to clean project: Failed to delete arb/jenkins/workspaceptyi/targetyi.jar -> [Help 1]
14:10:47 [JENKINS] Archiving arb/jenkins/workspaceptyi/pom.xml to com.ruoyi/ruoyi/2.2.0/ruoyi-2.2.0.pom
14:10:47 [ERROR] 
14:10:47 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
14:10:47 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
14:10:47 [ERROR] 
14:10:47 [ERROR] For more information about the errors and possible solutions, please read the following articles:
14:10:47 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

问题原因:
构建新建的target目录为root用户才可访问。

解决方法:

  1. 修改jenkins默认用户为root
// 打开jenkins配置文件
vi /etc/sysconfig/jenkins

// 将原来的jenkins用户修改为 root用户
JENKINS_USER="root"
  1. 更改jenkins三个文件夹的用户所有都和用户组
chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins
  1. 重启Jenkins服务并检查运行Jenkins的用户是否已经切换为root
systemctl restart jenkins
  1. 查看Jenkins进程所属用户
ps -ef | grep jenkins

在这里感谢Semanteme,本文引用原文地址,通过他的文章解决了所遇到的问题,同时记录一下个人日志。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值