java Maven 找不到父 POM

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10474583/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 01:12:56  来源:igfitidea点击:

Maven can't find parent POM

javamavenpom.xml

提问by MrProper

I am trying to build a maven project, but I have encountered problem.

我正在尝试构建一个 maven 项目,但遇到了问题。

pom has specified parent pom and maven can't find it. I actually have the parent pom, but I don't know where to place it or what should I do so maven knows about.

pom 已指定父 pom,而 maven 找不到它。我实际上有父 pom,但我不知道把它放在哪里或者我应该做什么,所以 maven 知道。

I'm new to maven so sorry if my question is stupid.

如果我的问题很愚蠢,我是 maven 的新手,很抱歉。

回答by Viktor Nordling

If you have the parent pom, you could try installing it.

如果你有父 pom,你可以尝试安装它。

When you run mvn installon a module the resulting artifact will be placed in your repository, so that it can be used from other modules.

当您mvn install在模块上运行时,生成的工件将放置在您的存储库中,以便可以从其他模块中使用它。

回答by afro54

I am using Netbeans, I ran -N versions:update-child-modulesin Run Maven/Goals.

我正在使用 Netbeans,我在 Run Maven/Goals 中运行了-N versions:update-child-modules

It worked! It took 5 minutes to build but, it did build the project, and that's the first time that it has.

有效!构建花了 5 分钟,但它确实构建了项目,这是它第一次构建。

回答by Leo Prince

http://maven.apache.org/guides/introduction/introduction-to-the-pom.htmlExample 1 and Example 2 are for Inheritance that can be usefull.

http://maven.apache.org/guides/introduction/introduction-to-the-pom.html示例 1 和示例 2 用于继承,可能很有用。

回答by Gehison Gaitan

This happens when the different POM in the project. They do not have the same version.

当项目中的 POM 不同时会发生这种情况。他们没有相同的版本。

For example if you have:

例如,如果您有:

MyProject / EAR ..... MyProject / WEB .....

you need to have the same version in three POM

您需要在三个 POM 中具有相同的版本

回答by Ashish Thakur

Same error for me.I resolved by updating the project with a new POM file(someone form my team accidently deleted it).

对我来说同样的错误。我通过使用新的 POM 文件更新项目来解决(我团队的某个人不小心删除了它)。