摆脱 org.eclipse.m2e:lifecycle-mapping 的 POM not found 警告
为了让 m2e 1.0 正常工作,我必须指定生命周期映射:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<versionRange>[2.0.2,)</versionRange>
<goals>
<goal>process</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
但随后我收到此警告:
[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0
如果我运行某些特定的 Maven 任务,例如 mvn clean install findbugs:findbugs
(如果我运行只有mvn clean install
则没有这样的消息)
我知道问题是这个POM不存在,因为它只是定义来保存映射信息。 (m2e 生命周期映射未找到)
无论如何,我想保持我的构建干净,没有任何警告,那么我怎样才能摆脱这个特定的警告呢? (我的 CI 服务器检查没有警告。)
我使用 Maven 3.0.2,也尝试过 Maven 3.0.3,但结果相同。
With intent to get m2e 1.0 working correctly I have had to specify the lifecycle mapping:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<versionRange>[2.0.2,)</versionRange>
<goals>
<goal>process</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
But then I get this warning:
[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0
if I run some specific maven task for example mvn clean install findbugs:findbugs
(If I run only mvn clean install
then there is no such message)
I know that the problem is that this POM does not exists, because it is only defined to hold the mapping information. (m2e lifecycle-mapping not found)
Anyway, I want to keep my build clean, without any warnings, so how can I get rid of this specific one? (My CI server checks that there is no warning.)
I use Maven 3.0.2 and tried Maven 3.0.3 too, but the same result.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
此解决方案现已弃用,我建议使用 @ctrueden 的“配置文件”解决方案,这是公认的答案!
虽然不是最干净的解决方案,但当您在公司中使用存储库管理器时或者独自一人,同时您可以执行以下操作:
- 签出 https://github.com/mfriedenhagen/dummy-lifecycle-mapping-plugin< /a>.
- 当你独自一人时运行
mvn install
- 当您拥有 Nexus 或 Artifactory 等存储库管理器时,运行
mvn deploy -DaltDeploymentRepository=REPO_ID::default::YOUR_THIRDPARTY_REPO_URL
。- 请参阅 https://github.com/mfriedenhagen/ dummy-lifecycle-mapping-plugin/blob/master/README.creole 以及。
问候
米尔科
This solution is now deprecated, I would recommend using the "profile" solution by @ctrueden which is the accepted answer!
While not the most clean solution, when you use a repository manager in your company or are on your own, in the mean time you may do this:
- Checkout https://github.com/mfriedenhagen/dummy-lifecycle-mapping-plugin.
- Run
mvn install
when you are on your own- Run
mvn deploy -DaltDeploymentRepository=REPO_ID::default::YOUR_THIRDPARTY_REPO_URL
when you have a repository manager like Nexus or Artifactory.- See https://github.com/mfriedenhagen/dummy-lifecycle-mapping-plugin/blob/master/README.creole as well.
Regards
Mirko
现在有更好的解决方案(仅适用于 Eclipse 中的错误消息)。
出现错误时按 CTR+1 生命周期配置未涵盖插件执行:org.codehaus.mojo:buildnumber-maven-plugin:1.1:create-timestamp (execution: default-create-timestamp) ,阶段:验证),然后选择此选项:
这有效使用 org.eclipse.m2e.editor.xml_1.2.0.20120903-1050.jar 插件(也可能更早)
Now there's now better solution (for the error messages in Eclipse only).
Press CTR+1 on the error Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:buildnumber-maven-plugin:1.1:create-timestamp (execution: default-create-timestamp, phase: validate) and then select this option:
This works with
org.eclipse.m2e.editor.xml_1.2.0.20120903-1050.jar
plugin (maybe earlier also)我的团队通过将相关配置包装在配置文件中来解决这个问题:
My team works around this problem by wrapping the relevant configuration in a profile:
m2eclipse 1.7.0 引入了一种替代方案,即 XML 处理指令。
来“注释”
maven-processor-plugin
的process
目标的每个在原始示例中,您只需使用See 版本有关语法和其他选项的更多详细信息,请参阅注释。
m2eclipse 1.7.0 introduced an alternative, namely an XML processing instruction.
In the original example, you would simply “annotate” every
<execution>
of themaven-processor-plugin
’sprocess
goal withSee the release notes for more details on the syntax and further options.
这是一个已知错误,已解决WONTFIX。在我看来,建议的解决方案是最简单的:
并
安装
这个项目。This a known bug with WONTFIX resolution. The suggested solution is the simplest in my opinion:
and
install
this project.