在Maven存储库中找不到项目

在Maven存储库中找不到项目

本文介绍了在Maven存储库中找不到项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a Maven module with a submodule.

父级的相关部分是这样的:

The relevant part of the parent is this:

  <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模块呢?为什么在本地看不到它?

So why is it trying to find the parne module in the online Maven repository?Why doesn't see it locally?

推荐答案

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

Your parent version is <version>1.0-SNAPSHOT</version>, but in the child pom.xml parent version is <version>1.0</version> make it same

这篇关于在Maven存储库中找不到项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 05:31