且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Maven:不可解析的父POM和"parent.relativePath"指向错误的本地POM

更新时间:2022-04-26 01:55:12

Maven多模块项目的常规布局是:

The normal layout for a maven multi module project is:

parent
├── pom.xml
├── module
    ├── pom.xml

检查您是否使用此布局.

Check that you use this layout.

另外:

  1. relativePath看起来很奇怪.代替".."

  1. the relativePath looks strange. Instead of '..'

<relativePath>..</relativePath>

改为尝试"../":

<relativePath>../</relativePath>

如果使用标准布局,也可以删除relativePath.这是我一直在做的事情,在命令行上,我也可以构建父级(和所有模块)或仅构建一个模块.

You can also remove relativePath if you use the standard layout. This is what I always do, and on the command line I can build as well the parent (and all modules) or only a single module.

模块路径可能错误.在父级中,您将模块定义为:

The module path may be wrong. In the parent you define the module as:

<module>junitcategorizer.cutdetection</module>

您必须指定子模块的文件夹名称,而不是工件标识符.如果junitcategorizer.cutdetection不是文件夹的名称,请相应地更改它.

You must specify the name of the folder of the child module, not an artifact identifier. If junitcategorizer.cutdetection is not the name of the folder than change it accordingly.

希望有帮助.

EDIT 看看另一篇文章,我在那回答.

EDIT have a look at the other post, I answered there.