Maven打包报错:[WARNING] The POM for xxx is missing, no dependency inform

maven install 或 package 时 ,执行警告报错:

[WARNING] The POM for com.xx-base:jar:1.0 is missing, no dependency information available


[ERROR] Failed to execute goal on project xx-mobi: Could not resolve dependencies for project com.xx-mobi:jar:1.0: Failed to collect dependencies at xx-base:jar:1.0: Failed to read artifact descriptor for xx-base:jar:1.0: Could not find artifact xx-root:pom:1.0 in geotoolrepo...

 

这是因为maven项目子模块在执行安装打包相关操作的时候,没有先执行公共模块。即项目有一个公共模块xx-base; 当前需要执行的模块为xx-mobi,那么应该先install xx-base,再执行xx-mobi 相关的操作。

场景

如下图使用Maven创建的一个多模块项目,一个wa-service模块,一个wa-app模块,wa-app模块依赖于wa-service模块,且他们都是WebAppDemo的子模块。

报错及分析

  • wa-app模块执行打包,报[WARNING] The POM for com.mxc:wa-service:jar:1.0-SNAPSHOT is missing, no dependency information available,打包失败。
  • 根据上述错误信息,初步分析是在仓库中没有找到依赖的wa-service模块的jar包。于是想到先对wa-service模块进行安装操作,然后在对wa-app模块执行打包,但结果仍然是报[WARNING] The POM for com.mxc:wa-service:jar:1.0-SNAPSHOT is missing, no dependency information available,原因不明。

解决

通过百度,找到一种解决方案:先在父模块WebAppDemo上执行install打包安装,之后就可以对wa-app模块执行打包操作了。
说明:对父模块进行打包安装操作,会同时对它下面的所有子模块进行打包安装。针对上面的项目,父模块打包安装之后,在本地仓库可以找到三个模块打包安装之后的文件。

我的maven本地仓库地址是C:\Users\Administrator\.m2\repository

posted @ 2019-07-01 16:19  以德为先  阅读(36375)  评论(3编辑  收藏  举报