解决:Could not resolve dependencies for project xxx: Could not find artifact xxx

引言

运行A module,找不到B module的依赖报错。A、B module都在project中。

  • 报错信息
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------< com.totainfo.schedulingsystem:aps >------------------
[INFO] Building aps 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.totainfo.schedulingsystem.strategy:aps-strategy-schedule-wip:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.872 s
[INFO] Finished at: 2021-12-30T20:55:47+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project aps: Could not resolve dependencies for project com.totainfo.schedulingsystem:aps:jar:0.0.1-SNAPSHOT: Could not find artifact com.totainfo.schedulingsystem.strategy:aps-strategy-schedule-wip:jar:0.0.1-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

Process finished with exit code 1

原因分析

我之前通过设置,将代码的build工作委托给了maven。

所以我点击运行的时候,idea不会使用自带的build功能进行build,而是使用maven进行build。

而点开看运行配置会发现,启动前的行为Build

查看log可知maven只会build当前module,所以其它module的依赖找不到。

解决方法

修改运行配置,运行前Build Project

点击运行,可以从log中看到maven将其它module也build了,问题解决。

posted @ 2021-12-30 21:22  daheww  阅读(5920)  评论(0编辑  收藏  举报