本文介绍了摆脱 org.eclipse.m2e:lifecycle-mapping 的 POM not found 警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了让 m2e 1.0 正常工作,我必须指定生命周期映射:

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

如果我运行一些特定的 maven 任务,例如 mvn clean install findbugs:findbugs(如果我只运行 mvn clean install 那么没有这样的消息)

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)

我知道问题是这个POM不存在,因为它只是定义了保存映射信息.(​​未找到 m2e 生命周期映射)

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)

无论如何,我想保持我的构建干净,没有任何警告,那么我怎样才能摆脱这个特定的呢?(我的 CI 服务器检查没有警告.)

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.)

我使用 Maven 3.0.2 并尝试过 Maven 3.0.3,但结果相同.

I use Maven 3.0.2 and tried Maven 3.0.3 too, but the same result.

推荐答案

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

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>

这篇关于摆脱 org.eclipse.m2e:lifecycle-mapping 的 POM not found 警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-18 19:25