简体   繁体   English

在构建项目时进行Maven配置

[英]Maven configuration while building project

I have crated maven project in eclipse to compile xstream library for java 1.4. 我已经在Eclipse中创建了Maven项目来为Java 1.4编译xstream库。 Currently I have several errors shown below. 目前,我有几个错误如下所示。

Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.5:maven-version (execution: versions, phase: initialize) 生命周期配置未涵盖的插件执行:org.codehaus.mojo:build-helper-maven-plugin:1.5:maven-version(执行:版本,阶段:初始化)

What is that? 那是什么?

maven-resources-plugin prior to 2.4 is not supported by m2e. m2e不支持2.4之前的maven-resources-plugin。 Use maven-resources-plugin version 2.4 or later. 使用maven-resources-plugin 2.4或更高版本。

Where to get this plugin? 在哪里可以得到这个插件?

And several other errors similar to firs one: 以及其他与第一个错误类似的错误:

Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.5:parse-version (execution: versions, phase: initialize) 生命周期配置未涵盖的插件执行:org.codehaus.mojo:build-helper-maven-plugin:1.5:parse-version(执行:版本,阶段:初始化)

Plugin execution not covered by lifecycle configuration: org.apache.felix:maven-bundle-plugin:2.3.7:manifest (execution: bundle-manifest, phase: process-classes) 生命周期配置未涵盖插件执行:org.apache.felix:maven-bundle-plugin:2.3.7:manifest(执行:bundle-manifest,阶段:process-classes)

在此处输入图片说明

How to solve these problems? 如何解决这些问题?

This is caused because Maven and Eclipse are two different building tools, sometimes resembling and sometimes disjoint. 这是因为Maven和Eclipse是两个不同的构建工具,有时相似,有时不相交。 So, the M2 plugin is supposed to adapt the POM's contents to the building lifecycle of Eclipse. 因此,应该使用M2插件使POM的内容适应Eclipse的构建生命周期。 However, as Maven's building lifecycle is much more complete than Eclipse's, M2 is not always able to do such an adaptation, and in these cases it raises the error you are asking about. 但是,由于Maven的构建生命周期比Eclipse的构建生命周期要完整得多,因此M2并不总是能够进行这样的调整,在这种情况下,它会引起您所要求的错误。

Usually, you should not worry a lot about this , because the project will eventually be built by Maven , so the important thing is the POM be 100% understood by Maven, not Eclipse. 通常,您不必为此担心很多 ,因为该项目最终将由Maven构建,因此重要的是Paven应该由Maven(而不是Eclipse)100%理解。 We use Eclipse mostly for the automatic building, not for producing the final JAR. 我们主要将Eclipse用于自动构建,而不是用于生成最终的JAR。

Anyway, you can drop these errors through three alternative options (available in the very screenshots you have posted): 无论如何,您可以通过三个替代选项(已发布的屏幕快照中提供)删除这些错误:

  • Discover new M2 connectors : I do not recommend this, if you are using the latest M2 version. Discover new M2 connectors :如果您使用的是最新的M2版本,则不建议这样做。 You can give it a try once, if you want. 如果需要,可以尝试一下。

The other two options are both aimed to instruct Eclipse to ignore the reported plugins: 其他两个选项都旨在指示Eclipse 忽略所报告的插件:

  • Permanently mark goal X in pom.xml as ignored : It adds an extra declaration to the POM marking that plugin as ignorable by Eclipse. Permanently mark goal X in pom.xml as ignored :它向POM添加了一个额外的声明,将该插件标记为Eclipse可忽略。
  • Mark goal X as ignored in Eclipse build : It leaves the POM unmodified, but adds that info to the current Eclipse workspace metadata, so it will be applied to all POMs (present and future) in the same workspace. Mark goal X as ignored in Eclipse build :它使POM保持不变,但是将该信息添加到当前Eclipse工作区元数据中,因此它将应用于同一工作区中的所有POM(现在和将来)。

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

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