maven打包 Failed to execute goal on project XX: Could not resolve dependencies for project 问题

红太狼 2023-06-08 06:45 47阅读 0赞

将一个新项目打包为 Jar 上线时发生了这个错误

  1. Failed to execute goal on project mayimq-client: Could not resolve dependencies for project cn.wangchunlong:mayimq-client:jar:1.0: The following artifacts could not be resolved: cn.wangchunlong:mayimq-utils:jar:1.0, cn.wangchunlong:mayimq-remoting:jar:1.0: Could not find artifact cn.wangchunlong:mayimq-utils:jar:1.0 in spring-snapshots (https://repo.spring.io/snapshot) -> [Help 1]
  2. 这是因为我项目有个地方引用了本地的几个依赖包,而依赖包没有通过maven编译的原因,找到那几个依赖包的项目,使用maven打包命令导包,命令是 mvn install
  3. 如果使用Eclipse 可以直接项目右键 ---》Run As ----》maven install就可以了,
  4. 如果是 IDEA Terminal 控制栏中输入 mvn install 输入命令进行手动打包

操作完上述过程后到你所需要打包的项目重新打包就行了,对了,如果要打成 Jar 包的话必须是 使用的是JDK,而不能是 JRE

发表评论

表情:
评论列表 (有 0 条评论,47人围观)

还没有评论,来说两句吧...

相关阅读