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

时间:2014-09-22 08:05:58

标签: java eclipse maven m2e

由于 Maven 3.2.2 支持定义pom的parent version with ranges,是否可以配置m2e插件来解析版本范围?怎么样?

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

场景:使用m2e插件将具有以下父定义的maven项目导入eclipse(项目不是其父项的模块)

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

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

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:问题不在于这是否是一种好习惯,请参阅Benjamin's comment了解某些背景信息。

How to configure maven or eclipse in order to use the RELEASE constant within versions?

相关

1 个答案:

答案 0 :(得分:1)

应修改m2e v1.6.x

针对M2E的Bugzilla #445883(重复#438441

作为一种解决方法,使用LATEST或RELEASE作为父pom的版本应该有效。