解决jenkins构建时提示:Failed to create parent directories for tracking file /xxx/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom.lastUpdated

报错提示:

[INFO] ------------------------------------------------------------------------
[INFO] Building allkusa entity project 1
[INFO] ------------------------------------------------------------------------
Downloading:  

[WARNING] Failed to create parent directories for tracking file /opt/maven_local_repository/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom.lastUpdated

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.427 s
[INFO] Finished at: 2019-12-05T21:37:50+08:00
[INFO] Final Memory: 8M/150M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: 
Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact 
org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): 
/opt/maven_local_repository/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom.part.lock (No such file or directory) -> [Help 1]


报错解释:

无法生成目录: /opt/maven_local_repository/org/apache/maven/plugins/maven-clean-plugin/2.5

 

使用命令查看仓库目录所属:

cd /opt
ls -l

drwxr-xr-x   7 root    root    4096 Dec  5 21:39 centos_java_soft


发现/opt/maven_local_repository的用户和组是 root;

jenkins 使用的是 jenkins 用户和组,改变目录/opt/maven_local_repository的用户组为jenkins 即可:

chown -R jenkins:jenkins /opt/maven_local_repository



同类文章