2015-03-31 216 views
-1

我想通過Jenkins和maven Build來運行一個項目。jenkins maven無法解決項目的依賴關係

庫使用-git 的代碼從庫中取出使用

生成工具 - Maven的

現在,使用Maven的調用頂級行家的目標 - 清潔安裝 它給出了下面的錯誤運行時所建。

但是,當我在命令提示符下執行此分析並通過maven eclipse沒有問題並且構建成功。

我在詹金斯

控制檯輸出請注意: - 如果你不能看到的圖像只是放大使用CTRL +

enter image description here

 
    FailedConsole Output 

    Started by user jones 
    [EnvInject] - Loading node environment variables. 
    Building on master in workspace C:\Program Files (x86)\Jenkins\jobs\Mar31SpringMVCPOC\workspace 
    > C:\Program Files (x86)\Git\cmd\git.exe rev-parse --is-inside-work-tree # timeout=10 
    Fetching changes from the remote Git repository 
    > C:\Program Files (x86)\Git\cmd\git.exe config remote.origin.url https://github.com/jonesjalapatgithub/Mar31Springpoc.git # timeout=10 
    Fetching upstream changes from https://github.com/jonesjalapatgithub/Mar31Springpoc.git 
    > C:\Program Files (x86)\Git\cmd\git.exe --version # timeout=10 
    using .gitcredentials to set credentials 
    > C:\Program Files (x86)\Git\cmd\git.exe config --local credential.helper store --file=\"C:\Windows\TEMP\git5818541449937257930.credentials\" # timeout=10 
    > C:\Program Files (x86)\Git\cmd\git.exe -c core.askpass=true fetch --tags --progress https://github.com/jonesjalapatgithub/Mar31Springpoc.git +refs/heads/*:refs/remotes/origin/* 
    > C:\Program Files (x86)\Git\cmd\git.exe config --local --remove-section credential # timeout=10 
    > C:\Program Files (x86)\Git\cmd\git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10 
    > C:\Program Files (x86)\Git\cmd\git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10 
    Checking out Revision 21788e4bc94fb2bd274935890a302529f8a17c6a (refs/remotes/origin/master) 
    > C:\Program Files (x86)\Git\cmd\git.exe config core.sparsecheckout # timeout=10 
    > C:\Program Files (x86)\Git\cmd\git.exe checkout -f 21788e4bc94fb2bd274935890a302529f8a17c6a 
    > C:\Program Files (x86)\Git\cmd\git.exe rev-list 21788e4bc94fb2bd274935890a302529f8a17c6a # timeout=10 
    [workspace] $ D:\softwares\apache-maven-3.0.3\bin\mvn.bat clean install 
    [INFO] Scanning for projects... 
    [WARNING] 
    [WARNING] Some problems were encountered while building the effective model for com.demo.common:SpringMVC:war:1.0-SNAPSHOT 
    [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 79, column 12 
    [WARNING] 
    [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. 
    [WARNING] 
    [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. 
    [WARNING] 
    [INFO]                   
    [INFO] ------------------------------------------------------------------------ 
    [INFO] Building SpringMVC Maven Webapp 1.0-SNAPSHOT 
    [INFO] ------------------------------------------------------------------------ 
    Downloading: http://repo1.maven.org/maven2/org/springframework/spring-core/3.0.5.RELEASE/spring-core-3.0.5.RELEASE.pom 

    Downloading: http://repo1.maven.org/maven2/org/springframework/spring-web/3.0.5.RELEASE/spring-web-3.0.5.RELEASE.pom 

    Downloading: http://repo1.maven.org/maven2/org/springframework/spring-webmvc/3.0.5.RELEASE/spring-webmvc-3.0.5.RELEASE.pom 

    [INFO] ------------------------------------------------------------------------ 
    [INFO] BUILD FAILURE 
    [INFO] ------------------------------------------------------------------------ 
    [INFO] Total time: 0.494s 
    [INFO] Finished at: Tue Mar 31 19:14:37 IST 2015 
    [INFO] Final Memory: 4M/149M 
    [INFO] ------------------------------------------------------------------------ 
    [ERROR] Failed to execute goal on project SpringMVC: Could not resolve dependencies for project com.demo.common:SpringMVC:war:1.0-SNAPSHOT: Failed to collect dependencies for [org.springframework:spring-core:jar:3.0.5.RELEASE (compile), org.springframework:spring-web:jar:3.0.5.RELEASE (compile), org.springframework:spring-webmvc:jar:3.0.5.RELEASE (compile), org.mockito:mockito-all:jar:1.8.5 (test), junit:junit:jar:4.5 (test)]: Failed to read artifact descriptor for org.springframework:spring-core:jar:3.0.5.RELEASE: Could not transfer artifact org.springframework:spring-core:pom:3.0.5.RELEASE from/to central (http://repo1.maven.org/maven2): Access denied to: http://repo1.maven.org/maven2/org/springframework/spring-core/3.0.5.RELEASE/spring-core-3.0.5.RELEASE.pom -> [Help 1] 
    [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/DependencyResolutionException 
    Build step 'Invoke top-level Maven targets' marked build as failure 
    Notifying upstream projects of job completion 
    Finished: FAILURE 

+0

它不是一個代碼,因此圖片將better.I已經在我的編輯添加的控制檯輸出。 – 2015-03-31 14:33:18

+0

你能從詹金斯訪問命令行嗎?如果是這樣,請運行'mvn help:describe -DartifactId = maven-compiler-plugin -DgroupId = org.apache.maven.plugins'看起來您的Jenkins服務器缺少Jenkins用戶的.m2目錄中的一些庫。如果需要,可以編輯作業以包含-X作爲參數以獲取更多信息。 – TheFiddlerWins 2015-03-31 15:21:22

+0

如果我去.m2存儲庫,我可以看到項目所需的所有依賴項。正如我所說的,當我使用cmd運行項目時,它正在取得成功。 – 2015-03-31 15:59:11

回答

0

我找到了問題的解決方法。

我創建了另一個Jenkins用戶,然後創建了另一個jenkins項目。然後我使用相同的配置運行此項目,但使用新用戶。

令我驚訝的是,通過下載它的依賴項目,項目成功了。 我不知道如何或爲什麼它不在以前的情況下工作。

enter image description here

+0

不要忘記將問題表明爲「已回答」,以便將其從待定問題列表中刪除。 – 2015-04-03 08:15:40