无法在Maven存储库中找到项目

时间:2017-01-04 19:02:11

标签: maven

我有一个带子模块的Maven模块。

父母的相关部分是:

  <groupId>my.package.name</groupId>
  <artifactId>parent-module</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>my.package.name</name>

  <modules>
      <module>child-module</module>
  </modules>

孩子的相关部分是:

 <groupId>my.package.name</groupId>
  <artifactId>child-module</artifactId>
  <version>1.0-SNAPSHOT</version>

  <name>my.package.name</name>

    <parent>
        <groupId>my.package.name</groupId>
        <artifactId>parent-module</artifactId>
        <version>1.0</version>
        <relativePath>../pom.xml</relativePath> <!-- not necessary -->
    </parent>

为此,我得到了:

[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for my.package.name:child-module:1.0-SNAPSHOT: Failure to find my.package.name:parent-module:pom:1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 11, column 13
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project my.package.name:child-module:1.0-SNAPSHOT (/path/to/parent-module/child-module/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for my.package.name:child-module:1.0-SNAPSHOT: Failure to find my.package.name:parent-module:pom:1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 11, column 13 -> [Help 2]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

XML文件位于:

/parent-module/child-module/pom.xml

/parent-module/pom.xml

那么为什么要在在线Maven存储库中找到parne模块呢? 为什么不在本地看到它?

2 个答案:

答案 0 :(得分:3)

  

找不到my.package.name:parent-module:pom:1.0

您的父版本是<version>1.0-SNAPSHOT</version>,但在子pom.xml中,父版本<version>1.0</version>使其相同

答案 1 :(得分:1)

尝试执行:

  

mvn -U clean install

Using Maven's -U Command Line Option