【问题标题】:jenkins maven could not resolve dependencies for projectjenkins maven 无法解析项目的依赖关系
【发布时间】:2015-06-04 21:58:41
【问题描述】:

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

使用的存储库 -git 代码是从存储库中获取的

使用的构建工具 - Maven

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

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

我在 jenkins 中的控制台输出

请注意:- 如果您看不到图像,请使用 ctrl++ 进行缩放

失败控制台输出 由用户 jones 发起 [EnvInject] - 加载节点环境变量。 建立在工作区 C:\Program Files (x86)\Jenkins\jobs\Mar31SpringMVCPOC\workspace 的 master 上 > C:\Program Files (x86)\Git\cmd\git.exe rev-parse --is-inside-work-tree # timeout=10 从远程 Git 存储库获取更改 > C:\Program Files (x86)\Git\cmd\git.exe 配置 remote.origin.url https://github.com/jonesjalapatgithub/Mar31Springpoc.git # timeout=10 从 https://github.com/jonesjalapatgithub/Mar31Springpoc.git 获取上游更改 > C:\Program Files (x86)\Git\cmd\git.exe --version # timeout=10 使用 .gitcredentials 设置凭据 > 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 签出修订版 21788e4bc94fb2bd274935890a302529f8a17c6a(参考/远程/起源/主) > 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 [工作区] $ D:\softwares\apache-maven-3.0.3\bin\mvn.bat 全新安装 [INFO] 正在扫描项目... [警告] [警告] 在为 com.demo.common:SpringMVC:war:1.0-SNAPSHOT 构建有效模型时遇到了一些问题 [警告] org.apache.maven.plugins:maven-compiler-plugin 的“build.plugins.plugin.version”缺失。 @ 第 79 行,第 12 列 [警告] [警告] 强烈建议修复这些问题,因为它们会威胁您构建的稳定性。 [警告] [警告] 出于这个原因,未来的 Maven 版本可能不再支持构建此类格式错误的项目。 [警告] [信息] [信息] --------------------------------------------- ------------------------- [INFO] 构建 SpringMVC Maven Webapp 1.0-SNAPSHOT [信息] --------------------------------------------- ------------------------- 下载:http://repo1.maven.org/maven2/org/springframework/spring-core/3.0.5.RELEASE/spring-core-3.0.5.RELEASE.pom 下载:http://repo1.maven.org/maven2/org/springframework/spring-web/3.0.5.RELEASE/spring-web-3.0.5.RELEASE.pom 下载:http://repo1.maven.org/maven2/org/springframework/spring-webmvc/3.0.5.RELEASE/spring-webmvc-3.0.5.RELEASE.pom [信息] --------------------------------------------- ------------------------- [信息] 构建失败 [信息] --------------------------------------------- ------------------------- [INFO] 总时间:0.494s [INFO] 完成时间:2015 年 3 月 31 日星期二 19:14:37 IST [INFO] 最终内存:4M/149M [信息] --------------------------------------------- ------------------------- [错误] 无法在项目 SpringMVC 上执行目标:无法解析项目 com.demo.common:SpringMVC:war:1.0-SNAPSHOT 的依赖项:无法收集 [org.springframework:spring-core:jar:3.0.5 的依赖项.RELEASE (编译), org.springframework:spring-web:jar:3.0.5.RELEASE (编译), org.springframework:spring-webmvc:jar:3.0.5.RELEASE (编译), org.mockito:mockito- all:jar:1.8.5 (test), junit:junit:jar:4.5 (test)]: 无法读取 org.springframework:spring-core:jar:3.0.5.RELEASE 的工件描述符:无法传输工件 org .springframework:spring-core:pom:3.0.5.RELEASE from/to central (http://repo1.maven.org/maven2):拒绝访问:http://repo1.maven.org/maven2/org/ springframework/spring-core/3.0.5.RELEASE/spring-core-3.0.5.RELEASE.pom -> [帮助 1] [错误] [错误] 要查看错误的完整堆栈跟踪,请使用 -e 开关重新运行 Maven。 [错误] 使用 -X 开关重新运行 Maven 以启用完整的调试日志记录。 [错误] [错误] 有关错误和可能的解决方案的更多信息,请阅读以下文章: [错误] [帮助 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException 构建步骤“调用顶级 Maven 目标”将构建标记为失败 通知上游项目工作完成 完成:失败

【问题讨论】:

  • 这不是代码,因此图片会更好。我在编辑中添加了控制台输出。
  • 你能从 Jenkins 访问命令行吗?如果是这样,请运行mvn help:describe -DartifactId=maven-compiler-plugin -DgroupId=org.apache.maven.plugins 看起来您的 Jenkins 服务器缺少 Jenkins 用户的 .m2 目录中的一些库。如果需要,您可以编辑作业以包含 -X 作为参数以获取更多信息。
  • 如果我转到 .m2 存储库,我可以看到项目所需的所有依赖项。正如我所说,当我使用 cmd 运行项目时,它取得了成功。
  • 位于此处:Access denied to: http://repo1.maven.org/maven2/org/springframework/spring-core/3.0.5.RELEASE/spring-core-3.0.5.RELEASE.pom 显示访问 maven Central 时出现问题。为什么不使用存储库管理器?
  • 我可以使用浏览器访问repo1.maven.org/maven2/org...,正如我所说,当我通过命令提示符运行时没有问题。

标签: git maven jenkins


【解决方案1】:

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

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

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

【讨论】:

  • 不要忘记将您的问题标为“已回答”,以便将其从待处理问题列表中删除。
猜你喜欢
  • 2020-09-09
  • 2022-01-23
  • 2015-09-01
  • 2021-04-03
  • 2015-01-14
  • 2014-09-05
  • 2021-08-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多