简体   繁体   English

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

[英]jenkins maven could not resolve dependencies for project

I want to run a project through Jenkins with maven Build. 我想使用Maven Build通过Jenkins运行一个项目。

Repository used -git The code is fetched from repository 使用的存储库-git从存储库中获取代码

Build Tool used - Maven 使用的构建工具-Maven

Now when running build using maven invoke top level maven targets -clean install It gives out the following error . 现在,当使用maven运行构建时,调用顶级maven目标-clean install它会发出以下错误。

But when i do this analysis in command prompt and eclipse through maven there is no issue and build is succeding . 但是,当我在命令提示符下进行此分析并通过Maven使其黯然失色时,就没有问题,并且构建成功。

My console output in jenkins 我的控制台输出在詹金斯

Please Note :- In case you cannot see the image just zoom using ctrl++ 请注意:-如果您看不到图像,请使用ctrl ++进行缩放

在此处输入图片说明

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

I found a workaround for the issue. 我找到了解决该问题的方法。

I created another Jenkins user and then created another jenkins project.Then i ran this project with the same configuration but with the new user. 我创建了另一个Jenkins用户,然后创建了另一个jenkins项目。然后我使用相同的配置但使用新用户来运行该项目。

Too my surprise the project became successful by downloading its dependencies. 令人惊讶的是,该项目通过下载其依赖项而成功。 I don't know how or why it was not working in the previous case. 我不知道在以前的案例中它如何或为什么不起作用。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM