简体   繁体   English

找不到父工件xxxxx:pom:2.0-SNAPSHOT

[英]Could not find parent artifact xxxxx:pom:2.0-SNAPSHOT

I have a parent project xxx-third, which has nothing but a pom declaring some dependencies and build configurations. 我有一个父项目xxx-third,它只有一个pom声明了一些依赖项和构建配置。

After I deploy it to the nexus and I can find it in the nexus web,I declare this xxx-thrid as my parent project of myProject. 在将其部署到网络上并可以在网络上找到它之后,我将此xxx-thrid声明为myProject的父项目。

Howerver, I still have the maven error complaining that Cound not find artifact com.myCom:xxx-third:pom:2.0-SNAPSHOT @ com.myCom:myProject. 但是,我仍然遇到Maven错误,抱怨Cound找不到工件com.myCom:xxx-third:pom:2.0-SNAPSHOT @ com.myCom:myProject。

But if I do install locally with the code, the problem will resolve, this is annoying! 但是,如果我使用代码在本地安装,问题将解决,这很烦人! Why and how to solve it? 为什么以及如何解决?

It is because this artifact is in your local .m2 repository on your local machine, but can't be downloaded from remote respository by your build server. 这是因为此工件位于本地计算机上的本地.m2存储库中,但是无法由构建服务器从远程存储库下载。 The local repostiory is in path: 当地的邮局正在路径中:

{USER_HOME}\.m2\repository\

You can copy the required dependency from your local repository to the local repository on your build server, then it will read the jar dependecy from local repo instead of fetching it from remote repo. 您可以将所需的依赖项从本地存储库复制到构建服务器上的本地存储库,然后它将从本地存储库读取jar依赖,而不是从远程存储库中获取它。

Your parent POM is not resolved. 您的父POM尚未解决。 There are three options to solve this: 有以下三种解决方案:

1) Add the parent POM to your local repository 1)将父POM添加到本地存储库

2) Add a relativePath to your child POM pointing to your parent POM (only makes sense in a multi-module project where source is in the same repository) 2)在指向您的父POM的子POM中添加一个relativePath(仅在源位于同一存储库中的多模块项目中才有意义)

<parent>
    <groupId>...</groupId>
    <artifactId>...</artifactId>
    <version>...</version>
    <relativePath>...</relativePath>
</parent>

3) Add a repository configuration to your settings.xml (eg makes sense if you have a company wide POM) 3)在您的settings.xml中添加存储库配置(例如,如果您拥有公司范围的POM,这很有意义)

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
  ...
  <profiles>
    <profile>
      ...
      <repositories>
        ...
      </repositories>
      ...
    </profile>
  </profiles>
  ...

As far as I understand 3) is your solution. 据我了解3)是您的解决方案。 See also: https://maven.apache.org/guides/introduction/introduction-to-the-pom.html https://maven.apache.org/settings.html 另请参阅: https : //maven.apache.org/guides/introduction/introduction-to-the-pom.html https://maven.apache.org/settings.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Maven - 不可解析的父 POM,找不到工件快照 - Maven - Non-resolvable parent POM, Could not find artifact SNAPSHOT 不可解析的父 POM:找不到工件 - Non-resolvable parent POM: Could not find artifact 不可解析的父 POM:找不到工件 - Non-resolvable parent POM: Could not find artifact 在pom.xml中找不到工件问题 - could not find artifact issue in pom.xml 在 Nexus 存储库中找不到工件(快照) - Could not find artifact (snapshot) in Nexus repository Maven中的Java EE 7 First Cup Tutorial错误:无法找到工件org.glassfish.javaeetutorial.firstcup:firstcup:pom:7.0.1-SNAPSHOT - Java EE 7 First Cup Tutorial errors in Maven: Could not find artifact org.glassfish.javaeetutorial.firstcup:firstcup:pom:7.0.1-SNAPSHOT Spring Sleuth和Zipkin:找不到神器io.zipkin.brave:brave-bom:pom:4.16.3-SNAPSHOT - Spring Sleuth and Zipkin:Could not find artifact io.zipkin.brave:brave-bom:pom:4.16.3-SNAPSHOT 无法传输工件 io.confluent:kafka-connect-storage-common-parent:pom:6.0.0-SNAPSHOT from/to confluent (${confluent.maven.repo}) - Could not transfer artifact io.confluent:kafka-connect-storage-common-parent:pom:6.0.0-SNAPSHOT from/to confluent (${confluent.maven.repo}) 找不到工件junit:unit:jar:5.0-SNAPSHOT - Could not find artifact junit:unit:jar:5.0-SNAPSHOT Maven:“找不到工件包:jar:1.0-SNAPSHOT”? - Maven: "Could not find artifact package:jar:1.0-SNAPSHOT"?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM