Jenkins 导入Maven项目,编译时候出错
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (https://repo.maven.apache.org/maven2): Specified destination directory cannot be created: /maven/repository/org/apache/maven/plugins/maven-clean-plugin/2.4.1 -> [Help 1]
[JENKINS] Archiving /var/lib/jenkins/workspace/test-for-maven2/pom.xml to springmvc-maven/easy-springmvc-maven/0.0.1-SNAPSHOT/easy-springmvc-maven-0.0.1-SNAPSHOT.pom
[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
channel stopped
Finished: FAILURE
解决办法
-
打开maven配置文件(maven安装目录下的settings.xml文件)
-
搜索mirrors关键字,加入mirror镜像节点
<mirror> <id>osc</id> <mirrorOf>*</mirrorOf> <url>http://maven.oschina.net/content/groups/public/</url> </mirror>
-
找到 localRepository
<localRepository>/maven/repository</localRepository>
-
创建上面的目录
mkdir -p /maven/repository chown -R jenkins.jenkins /maven