jenkins maven无法解决项目的依赖关系

时间:2015-03-31 14:14:23

标签: git maven jenkins

我想通过Jenkins和maven Build一起运行一个项目。

存储库使用-git 代码从存储库

获取

使用的构建工具 - Maven

现在使用maven运行构建调用顶级maven目标-clean install 它给出了以下错误。

但是当我在命令提示符下执行此分析并通过maven进行eclipse时,没有问题,构建正在成功。

我的控制台输出jenkins

请注意: - 如果您无法使用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

1 个答案:

答案 0 :(得分:0)

我找到了解决这个问题的方法。

我创建了另一个Jenkins用户,然后创建了另一个jenkins项目。然后我使用相同的配置运行此项目,但是使用了新用户。

令我惊讶的是,该项目通过下载其依赖项而获得了成功。 我不知道在前一种情况下它是如何或为什么不起作用。

enter image description here