简体   繁体   English

MVN发布包含父项的pom

[英]Mvn release a pom that contains a parent

I'm trying to create a release for a repo. 我正在尝试为回购创建发行版。 The problem I'm having is that when I run 我遇到的问题是我跑步时

mvn release:prepare -DdryRun= true

I am trying to run it on a pom.xml that has a parent. 我正在尝试在具有父级的pom.xml上运行它。

This is the pom.xml that I am trying to release. 这是我要发布的pom.xml。

...
<parent>
<groupId>com..ehr</groupId>
<artifactId>ehr-common</artifactId>
<version>0.5.0.26</version>
<relativePath> ../../EhrPom/main/pom.xml</relativePath>
</parent>
...

When I run the mvn release:prepare -DdryRun= true. 当我运行mvn release:prepare -DdryRun = true。 I receive this error. 我收到此错误。

[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/com//ehr//0.5.0.26/ehr-
-0.5.0.26.pom
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project com..ehr:emergency-login-webapp:2.0.7.0-SNAPSHOT   
(/Users/computer1/Documents/computer1_MacBook/depot//-  
webapp/main/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM: Could not find artifact  in central (http://repo1.maven.org/maven2) and 'parent.relativePath'
points at wrong local POM @ line 8, column 11 -> [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

Do I need to release the parent pom before to make this work? 要进行此工作,是否需要释放父pom? Does this have anything to due with the fact that its trying to download from http://repo1.maven.org/maven2/ and not my repo? 这是否与尝试从http://repo1.maven.org/maven2/而不是从我的repo下载的事实有关? Any help would be appreciated thanks! 任何帮助,将不胜感激,谢谢!

Yes, you must deploy the parent POM as well, because others need it when they depend on your artifact. 是的,您还必须部署父POM,因为其他人在依赖您的工件时需要它。 The parent pom.xml may contain further dependencies, properties and so on. pom.xml可能包含其他依赖项,属性等。 Therefore you will need to deploy it to your (remote) repository. 因此,您需要将其部署到您的(远程)存储库。

It might be easier for you to create a top-level pom.xml which contains the parent and artifacts as modules. 创建顶层pom.xml其中包含父项和工件作为模块)可能更容易。 Maven takes care of the right order, if you start the release process in this project, ie it will automatically release/deploy your parent POM before your artifacts. 如果您在该项目中启动发布过程,则Maven会按照正确的顺序进行操作,即,它将在发布工件之前自动发布/部署父POM。 Or if your parent POM is your root POM at the same time, just start the release process there and its modules should be automatically released too. 或者,如果您的父POM同时是您的根POM,则只需在此处开始发布过程,它的模块也应自动发布。

References: 参考文献:

犯了一个愚蠢的错误,未设置正确的存储库:/

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM