本文介绍了未找到 m2e 生命周期映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 此处描述的解决方案 解决烦人的生命周期配置未涵盖的插件执行:org.codehaus.mojo:build-helper-maven-plugin:1.7:add-source (execution: default, phase: generate-sources)" 当我放置以下内容时我的 pom.xml 上的插件:

I am trying to use the solution described here to solve the annoying "Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.7:add-source (execution: default, phase: generate-sources)" when I place the following plugin on my pom.xml:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
    <execution>
        <phase>generate-sources</phase>
        <goals><goal>add-source</goal></goals>
        <configuration>
            <sources>
                <source>src/bootstrap/java</source>
            </sources>
        </configuration>
    </execution>
</executions>
</plugin>

但是当我运行 mvn clean install 我得到这个:

But when I run mvn clean install I get this:

原因:存储库中未找到 POM 'org.eclipse.m2e:lifecycle-mapping':无法从任何存储库下载工件

Reason: POM 'org.eclipse.m2e:lifecycle-mapping' not found in repository: Unable to download the artifact from any repository

有人知道如何让 m2e 和 maven 开心吗?

Does anyone have a clue on how to make m2e and maven happy?

推荐答案

org.eclipse.m2e:lifecycle-mapping 插件实际上并不存在.它应该在 <build><pluginManagement> 部分使用 pom.xml.这样,Maven就不能解析,m2e可以读取.

The org.eclipse.m2e:lifecycle-mapping plugin doesn't exist actually. It should be used from the <build><pluginManagement> section of your pom.xml. That way, it's not resolved by Maven but can be read by m2e.

但是对于您的问题更实用的解决方案是在 eclipse 中安装 m2e build-helper 连接器.您可以从 Window > Preferences > Maven > Discovery > Open Catalog 安装它>.这样 build-helper-maven-plugin:add-sources 将在 eclipse 中被调用而无需您更改 pom.xml.

But a more practical solution to your problem would be to install the m2e build-helper connector in eclipse. You can install it from the Window > Preferences > Maven > Discovery > Open Catalog. That way build-helper-maven-plugin:add-sources would be called in eclipse without having you to change your pom.xml.

这篇关于未找到 m2e 生命周期映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-18 19:24