Maven父子工程install编译问题

Maven父子工程install编译问题

异常信息

[WARNING] The requested profile "nexus" could not be activated because it does not exist.
[ERROR] Failed to execute goal on project NettyDemos: Could not resolve dependencies for project com.crazymakercircle:NettyDemos:jar:1.0-SNAPSHOT: Failed to collect dependencies at com.crazymakercircle:chatcommon:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for com.crazymakercircle:chatcommon:jar:1.0-SNAPSHOT: Could not find artifact com.crazymakercircle:crazyCircleDemos: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

Process finished with exit code 1

异常分析

由于项目是Maven模块化工程,子模块相互依赖,编译子工程 NettyDemos时,由于依赖的工程chatcommon没有install进本地仓库或远程私服,所以出现无法找到依赖异常。简单的来说就是A依赖B,但是B在本地仓库或远程私服没有,所以出现异常。

异常解决

知道原因了,问题解决起来就很方便了嘛。直接install一下缺失的依赖工程即可。但是细心的小伙伴很快就发现。哎,怎么chatcommon(B) install成功之后,再install NettyDemos(A)仍然出现上面的异常呢?这是因为父工程没有清理。所以要想install成功,需要先运行父工程的maven clean。之后再在子工程运行maven install即可。

总结

Maven工程最好新建一个父工程,便于开发和打包。Java小白一个,如果有哪里解释的不对,还请多多指教。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值