3和relativePath表示法的不可解析的父POM

3和relativePath表示法的不可解析的父POM

本文介绍了使用Maven 3.0.3和relativePath表示法的不可解析的父POM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在迁移到Mavent 3.0.3之后,无法再解决多个项目中的父poms.

After migrating to Mavent 3.0.3 Parent poms in several Projects cannot be resolved anymore.

项目的结构采用默认方式,因此我设置了parent.relativePath到"../pom.xml"

The Projects are structured in a default manner, so I setparent.relativePath to "../pom.xml"

superpom (located in repository)
|-rootpom (located locally: no error)
|-|-parentpom (located locally: error resolving parent)
|-|-|-module1 (located locally: error resolving parent)
|-|-|-module2 (located locally: error resolving parent)
|-|-|-module3 (located locally: error resolving parent)
|-|-|-module4 (located locally: error resolving parent)

错误...

...似乎表明在存储库中搜索了pom,所以我想知道为什么在其他地方之前找不到本地pom.

... seems to indicate that the pom was searched for in the repository, so I wonderwhy the pom was not found locally before looked elsewere.

我已经读到,在settings.xml中定义了几个存储库时,maven3可能会感到困惑,但这始终是在存储库内部而不是本地搜索pom时出现的.

I have read that maven3 might get confused when several repositories are defined in the settings.xml, but that was always when searching for a pom inside repositories and not locally.

更新

到目前为止,我们确实在父项目级别(parentpom)上执行了maven构建-我不知道的一个事实很重要,因为maven2到目前为止已经成功完成了.

Up until now we did execute the maven build on the parent-project level (parentpom) - a fact wich I did not know was important, since maven2 completed successfully until now.

在使用maven3时,这似乎很重要.在根项目级别(rootpom)执行maven3时,构建成功完成.这样我的眼前问题就解决了.

When using maven3 this seems to be of importance.When executing maven3 on the root-project level (rootpom) the build finishes successfully.So my immediate problem is solved.

推荐答案

确保您再次检查子pom中引用的版本与父pom中引用的版本相同.对我而言,我将父版本的版本更改为3.1.0.0-RELEASE,但在子pom中,我仍通过relativePath引用了以前的版本,并将其定义为2.0.0.0-SNAPSHOT.如果仅包含父目录,或者将"pom.xml"附加到该目录,则没有任何区别:

Make sure you Double-Check that the version you refer to in the child-pom is the same as that in the parent-pom. For me, I'd bumped version in the parent and had it as 3.1.0.0-RELEASE, but in the child-pom, I was still referring to the previous version via relativePath, and had it defined as 2.0.0.0-SNAPSHOT. It did not make any difference if I included just the parent directory, or had the "pom.xml" appended to the directory:

    <parent>
    <artifactId>eric-project-parent</artifactId>
    <groupId>com.eric.common</groupId>
     <!-- Should be 3.1.0.0-RELEASE -->
    <version>2.0.0.0-SNAPSHOT</version>
    <relativePath>
                ../../EricParentAsset/projects/eric-project-parent</relativePath>
</parent>

这篇关于使用Maven 3.0.3和relativePath表示法的不可解析的父POM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 01:50