我先说下我的打包步骤

一、复现

我的应用中有两个模块:client和common
其中client依赖common

打包步骤

先打包common,build success
再打包client,此时出错!错误信息如下

[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< org.example:client >-------------------------
[INFO] Building client 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.309 s
[INFO] Finished at: 2020-06-17T16:58:00+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project client: Could not resolve dependencies for project org.example:client:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.example:common:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for org.example:common:jar:1.0-SNAPSHOT: Could not find artifact org.example:project-test:pom:1.0-SNAPSHOT -> [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

二、排查

上面错误信息中,有两行提示,我们摘出来

## 查看完整错误栈信息,可以添加-e 参数
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
## 查看完整的debug日志,可以添加-X 参数
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
1. 使用-e参数重新install

我们进入到client文件夹下,使用-e参数重新打包试试,看看它的异常栈信息

cd client
mvn clean install -e

2. 查看异常栈

异常栈很长查看最后一个即可,错误栈截图如下

清晰明了,打包异常的原因,就是因为没有找到org.example:project-test:pom:1.0-SNAPSHOT这个包!

三、解决

上面异常栈中org.example:project-test:pom:1.0-SNAPSHOT这个包,也就是子模块的父项目,即项目本身project-test。打包一下这个父项目,就能解决了。

结论

client打包时依赖common,而common依赖父工程project-test。
所以client先去本地查找project-test这个包;没找到就去私服中找,肯定还没找到;进而去中央仓库查找,还是没找到,就报错了!

四、授之以渔

  1. 遇到打包错误的情况不要慌,直接加-X或者-e参数重新打包,看看错误日志是什么,一般都会显示很清楚的。
    -X 参数:显示打包过程中的debug日志
    -e 参数:显示完成错误栈信息
  2. 仔细看错误信息
    我们把最初的报错信息再摘出来一段:
    [ERROR] Failed to execute goal on project client: Could not resolve dependencies for project org.example:client:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.example:common:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for org.example:common:jar:1.0-SNAPSHOT: Could not find artifact org.example:project-test:pom:1.0-SNAPSHOT -> [Help 1]
    直接看最后一个错误,也能很清晰的看到提示缺少project-test:pom:1.0-SNAPSHOT这个包。

Maven打包错误:Failed to execute goal on project client: Could not resolve dependencies for project相关推荐

  1. 使用idea进行Maven打包异常:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war

    使用idea进行Maven打包异常:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war 参考文章: (1) ...

  2. Maven打包时报Failed to execute goal org.apache.maven.plugins:maven-war-plugin:解决方案

    问题现象: 用Maven打包时,报Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war错误. 原因分析: 打 ...

  3. maven打包异常-Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEAS

    问题再现 在进行mvn打包的时候出现: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.R ...

  4. springboot maven 打包失败 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2

    maven 打包失败 一.问题描述: idea打包springboot项目,控制台提示: Failed to execute goal org.apache.maven.plugins:maven-s ...

  5. maven打包错误:Failed to execute goal on project service_base: Could not resolve dependencies for project

    错误: Failed to execute goal on project service_base: Could not resolve dependencies for project com.a ...

  6. maven 出现:Failed to execute goal on project...Could not resolve dependencies for project

    最近一个 maven 聚合工程出现了这个错误 尝试过的解决方案-但都无效 然后在网上尝试了各种方案,比如如下的解决方案: maven出现:Failed to execute goal on proje ...

  7. maven bug之Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (defau

    maven bug之Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (defau ...

  8. Maven提示Failed to execute goal on project itripbiz: Could not resolve dependencies for project org

    首先我是一个maven父项目下面放大子项依赖 我install的情况下提示 Failed to execute goal on project itripbiz: Could not resolve ...

  9. 解决:Failed to execute goal on project aopcore: Could not resolve dependencies for project com.cmos:

    前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 一.问题描述 maven工程  jar包无法下载,报错如下 :  [ERROR] Failed to ...

最新文章

  1. Python 文件与目录操作方法总结
  2. python animation 轨迹_Python实例:自动轨迹绘制
  3. java读写properties配置文件方法
  4. nyoj 61(双线程dp)
  5. mysql int(3)与int(11)的区别详解
  6. VHDL简单微处理器的设计
  7. HTTP协议支持的方法
  8. 什么人不在生死簿_地府在孙悟空划掉生死簿以后,因为什么原因不组织重写?...
  9. LibcarePlus用户态程序热补丁
  10. 谁在阻止RSS的普及??
  11. Ubuntu安装RabbitMQ及RabbitMQ基于使用
  12. 关于Revit API修改元素参数的问题?
  13. matlab 用循环求和,matlab求和不用循环
  14. 千兆网线与千兆水晶头接法
  15. Soya语言1.0.1-alpha发布!
  16. systemctl status network.service命令,Failed to start LSB: Bring up/down networking.完美解决
  17. pycharm中couldn‘t upload helpers for remote
  18. picker多选 vant_浅谈vant组件Picker 选择器选单选问题
  19. IE浏览器不能上网其他浏览器可以解决办法
  20. pythonSSL证书错误

热门文章

  1. weblogic获取classes下配置文件路径
  2. 2019年win10最好用的操作系统—win10专业版1903版本
  3. R语言学习笔记5:数据来源与解析
  4. 安霸收购4D雷达公司,下一代“融合感知”市场大战一触即发
  5. 鸿蒙系统样貌,EMUI11是如何炼成的?揭示鸿蒙OS未来的样貌
  6. Wpf BUG:组件“XXX”不具有由 URI“XXX“识别的资源
  7. Tars-Java网络编程源码分析
  8. sakai源码怎样学习
  9. Java Swing 期末大作业-----图书借阅管理系统
  10. 【转】php文件加密神器,可限制IP地址限制域名等