2017-02-17 63 views
0

我想安裝Jenkins以自動化項目構建,並且遇到以下問題。在使用maven-antrun-plugin時,mvn clean install在cmd中完美工作,但jenkins的項目生成失敗。Jenkins構建找不到資源,但maven確實

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run 
(clientgen) on project Sample: 
An Ant BuildException has occured: Compile failed; see the compiler error output for 
details. 
[ERROR] around Ant part ...<javac fork="yes" memoryInitialSize="512m" 
destdir="E:\Jenkins\workspace\Trunk Builds\Sample\target/generated-sources" 
memoryMaximumSize="1024m" srcdir="E:\Jenkins\workspace\Trunk Builds\Sample\target/build" 
source="1.4" classpathref="maven.plugin.classpath" executable="C:\j2sdk1.4.2_19/bin/javac" 
target="1.4"/>... @ 46:428 in 
E:\Jenkins\workspace\Trunk Builds\Sample\target\antrun\build-main.xml 

當我使用maven-antrun-plugin時,Jenkins實際上無法檢查導入的包。

[javac] E:/Jenkins/workspace/Trunk Builds/Sample/target/build/ClassSample.java:20: 
package org.sample.package does not exist 

每當我不使用maven-antrun-plugin Jenkin構建成功。任何想法,即使它通過CMD詹金斯工作無法建立該項目?

回答

0

其實我找到了真正的問題並找到了解決方法。問題在於Jenkins由於某種原因沒有訪問.m2/repository,因此我將Jenkins配置爲使用本地工作區存儲庫。現在它正常建立。