简体   繁体   English

如何配置m2e eclipse插件以支持父版本范围?

[英]How to configure m2e eclipse plugin to support parent version ranges?

Since Maven 3.2.2 supports defining the pom's parent version with ranges , is it possible to configure m2e plugin to resolve the version range? 由于Maven 3.2.2支持使用range定义pom的父版本 ,是否可以配置m2e插件来解析版本范围? How? 怎么样?

Edit 1: (2014-09-29 @ 09:50 AEST) 编辑1: (2014-09-29 @ 09:50 AEST)

Scenario: Importing a maven project with the following parent definition into eclipse with m2e plugin (the project is not a module of its parent) 场景:使用m2e插件将具有以下父定义的maven项目导入eclipse中(该项目不是其父模块)

<parent>
    <artifactId>artifactId</artifactId>
    <groupId>groupId</groupId>
    <version>[1.0,1.1)</version>
</parent>

M2E plugin fails to resolve the version range, showing this error message in the POM editor: M2E插件无法解析版本范围,在POM编辑器中显示此错误消息:

Could not transfer artifact groupId:artifactId:pom:[1.0,1.1) from/to nexus-releases (http://nexus.proxy/content/groups/public/): Illegal character in path at index 82: http://nexus.proxy/content/groups/public/groupId/artifactId/[1.0,1.1)/artifactId-[1.0,1.1).pom and 'parent.relativePath' points at wrong local POM

It works when running with Run as... > Maven install , see the log snippet below: 在以Run as... > Maven install时,它可以工作,请参见下面的日志片段:

[INFO] Scanning for projects...
[INFO] Downloading: http://nexus.proxy/content/groups/public/groupId/artifactId/maven-metadata.xml
[INFO] Downloading: http://nexus.proxy/content/groups/public/groupId/artifactId/maven-metadata.xml
[INFO] Downloading: http://nexus.proxy/content/groups/public-snapshot/groupId/artifactId/maven-metadata.xml
[INFO] Downloaded: http://nexus.proxy/content/groups/public-snapshot/groupId/artifactId/maven-metadata.xml (488 B at 0.8 KB/sec)
[INFO] Downloaded: http://nexus.proxy/content/groups/public/groupId/artifactId/maven-metadata.xml (2 KB at 2.1 KB/sec)
[INFO] Downloaded: http://nexus.proxy/content/groups/public/groupId/artifactId/maven-metadata.xml (2 KB at 2.1 KB/sec)
[INFO] Downloading: http://nexus.proxy/content/groups/public/groupId/artifactId/[1.0,1.1)/artifactId-[1.0,1.1).pom
[INFO] Downloading: http://nexus.proxy/content/groups/public/groupId/artifactId/[1.0,1.1)/artifactId-[1.0,1.1).pom

PS.: The question is not whether or not this is a good practice, please refer to Benjamin's comment for some background. PS .:问题不是这是否是一种好习惯,请参考本杰明的评论以了解某些背景。

Related to How to configure maven or eclipse in order to use the RELEASE constant within versions? 有关如何配置Maven或Eclipse以在版本中使用RELEASE常量?

Should be fixed on m2e v1.6.x 应该固定在m2e v1.6.x上

Bugzilla for M2E #445883 (duplicated of #438441 ) 适用于M2E的Bugzilla #445883 (与#438441重复)

As a workaround, using LATEST or RELEASE as parent pom's version should work. 解决方法是,使用LATEST或RELEASE作为父pom版本。

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

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