事实是,Solr 项目目录位于 MyProject 父目录内(但两者之间没有模块或任何 Maven 关系,只是 FS 方便)。

$ mvn -DskipTests clean install
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.apache.lucene:lucene-solr-grandparent:pom:3.1-SNAPSHOT
[WARNING] 'parent.relativePath' points at com.mycompany:MyProject instead of org.apache:apache, please verify your project structure @ line 23, column 11
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 

pom.xml

<parent>
    <groupId>org.apache</groupId>
    <artifactId>apache</artifactId>
    <version>8</version>
  </parent>

$ pwd
/Users/simpatico/ws/MyProjectBaseDir/solr

答案

添加一个空的 <relativePath><parent>以便它从存储库中解析父 pom。

  <parent>
    <groupId>org.apache</groupId>
    <artifactId>apache</artifactId>
    <version>8</version>
    <relativePath></relativePath>
  </parent>

这是相关的文档

此功能仅用于增强该项目本地结账的开发。
默认值为:../pom.xml

来自: stackoverflow.com