摆脱 org.eclipse.m2e:lifecycle-mapping 的 POM not found 警告

发布于 2024-12-12 02:26:39 字数 2370 浏览 0 评论 0原文

为了让 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

萌辣 2024-12-19 02:26:40

此解决方案现已弃用,我建议使用 @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

甜是你 2024-12-19 02:26:40

现在有更好的解决方案(仅适用于 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:

enter image description here

This works with org.eclipse.m2e.editor.xml_1.2.0.20120903-1050.jar plugin (maybe earlier also)

浮萍、无处依 2024-12-19 02:26:39

我的团队通过将相关配置包装在配置文件中来解决这个问题:

<profile>
  <id>only-eclipse</id>
  <activation>
    <property>
      <name>m2e.version</name>
    </property>
  </activation>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            ...
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</profile>

My team works around this problem by wrapping the relevant configuration in a profile:

<profile>
  <id>only-eclipse</id>
  <activation>
    <property>
      <name>m2e.version</name>
    </property>
  </activation>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            ...
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</profile>
追风人 2024-12-19 02:26:39

m2eclipse 1.7.0 引入了一种替代方案,即 XML 处理指令。

来“注释”maven-processor-pluginprocess 目标的每个

<?m2e execute?>

在原始示例中,您只需使用See 版本有关语法和其他选项的更多详细信息,请参阅注释

m2eclipse 1.7.0 introduced an alternative, namely an XML processing instruction.

In the original example, you would simply “annotate” every <execution> of the maven-processor-plugin’s process goal with

<?m2e execute?>

See the release notes for more details on the syntax and further options.

请持续率性 2024-12-19 02:26:39

这是一个已知错误,已解决WONTFIX。在我看来,建议的解决方案是最简单的:

mvn archetype:generate -DgroupId=org.eclipse.m2e -DartifactId=lifecycle-mapping \
 -Dversion=1.0.0 -DarchetypeArtifactId=maven-archetype-mojo

安装这个项目。

This a known bug with WONTFIX resolution. The suggested solution is the simplest in my opinion:

mvn archetype:generate -DgroupId=org.eclipse.m2e -DartifactId=lifecycle-mapping \
 -Dversion=1.0.0 -DarchetypeArtifactId=maven-archetype-mojo

and install this project.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文