m2e忽略了如何消除"maven-enforcer-plugin"(目标"enforce").日食警告? [英] How to eliminate the "maven-enforcer-plugin (goal "enforce") is ignored by m2e" warning by eclipse?

查看:208
本文介绍了m2e忽略了如何消除"maven-enforcer-plugin"(目标"enforce").日食警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用maven和eclipse m2e配置多模块父子maven项目,我正在使用eclipse Juno SR1的最新版本,即m2e 1.2.0

I am configuring a multi-module parent child maven project using maven and eclipse m2e, I am using the latest stuff from eclipse Juno SR1 which is m2e 1.2.0

父pom使用强制实施器插件,因此父pom.xml在其插件部分中具有以下内容

the parent pom uses the enforcer plugin, so the parent pom.xml has the following in its plugin section

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-enforcer-plugin</artifactId>
    <version>1.1.1</version>
    <executions>

        <!-- Enforce that all versions of a transative dependency must converge. -->
        <execution>
            <id>enforce</id>
            <configuration>
                <rules>
                    <DependencyConvergence />
                </rules>
            </configuration>
            <goals>
                <goal>enforce</goal>
            </goals>
        </execution>

        <!-- Black list certain jars -->
        <execution>
            <id>enforce-banned-dependencies</id>
            <goals>
                <goal>enforce</goal>
            </goals>
            <configuration>
                <rules>
                    <bannedDependencies>
                        <excludes>
                            <exclude>
                                commons-logging:commons-logging
                            </exclude>
                        </excludes>
                    </bannedDependencies>
                </rules>
                <fail>true</fail>
            </configuration>
        </execution>

    </executions>
</plugin>

每个子项目都有一条错误消息,提示maven-enforcer-plugin (goal "enforce") is ignored by m2e.

Each of the child projects has an error message saying maven-enforcer-plugin (goal "enforce") is ignored by m2e.

  • 此消息的含义是什么?
  • 如何配置东西以摆脱此消息?
  • 我需要配置Eclipse项目设置还是pom.xml设置?

推荐答案

eclipse maven插件运行一个项目pom.xml文件,以便弄清如何配置maven项目并将maven pom.xml配置转换为eclipse配置. pom.xml可以引用任意数量的maven插件,并且每个插件都有可能泄漏内存或执行对日食有害的操作.因此,默认情况下,m2e eclipse插件会忽略任何maven插件,除非这些maven插件具有特殊的m2e插件连接器,该连接器告诉m2e如何将maven插件集成到eclipse中.总而言之,m2e捍卫了eclipse JVM进程免受错误的maven插件的攻击,方法是说每个maven插件都需要一个m2e连接器来桥接maven和eclipse.

The eclipse maven plugin runs a projects pom.xml file in order figure out how the maven project is configured and translate the maven pom.xml configuration into an eclipse configuration. A pom.xml can reference an arbitrary number of maven plugins and each of those plugins has the potential to leak memory, or do things that are harmful to eclipse. So by default the m2e eclipse plugin ignores any maven plugins unless those maven plugins have a special m2e plugin connector that tells m2e how to integrate the maven plugin into eclipse. In summary m2e is defending the eclipse JVM process against a buggy maven plugin, by saying that for every maven plugin there needs to be an m2e connector to bridge between maven and eclipse.

为摆脱警告,我在父pom.xml的插件管理部分添加了以下内容

So to get rid of the warning I added the following to my plugin management section of the parent pom.xml

<build>
  <pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.eclipse.m2e</groupId>
        <artifactId>lifecycle-mapping</artifactId>
        <version>1.0.0</version>
        <configuration>
          <lifecycleMappingMetadata>
            <pluginExecutions>
              <pluginExecution>
                <pluginExecutionFilter>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-enforcer-plugin</artifactId>
                  <versionRange>[1.0.0,)</versionRange>
                  <goals>
                    <goal>enforce</goal>
                  </goals>
                </pluginExecutionFilter>
                <action>
                  <ignore />
                </action>
              </pluginExecution>
            </pluginExecutions>
          </lifecycleMappingMetadata>
        </configuration>
      </plugin>
    </plugins>
  </pluginManagement>
</build>

似乎org.eclipse.m2e:lifecycle-mapping是一个Maven插件,旨在处理元数据以与Eclipse m2e插件通信时处理maven pom.xml,并且该信息用于告诉eclipse如何处理pom中定义的maven插件. eclipse作为Eclipse UI的一部分运行pom.xml时为.xml.

It seems that org.eclipse.m2e:lifecycle-mappingis a maven plugin designed to hold meta data to communicate with eclipse m2e plugin when it processes a maven pom.xml and this information is used to tell eclipse what do with maven plugins that are defined in pom.xml when eclipse runs the pom.xml as part of the eclipse UI.

这篇关于m2e忽略了如何消除"maven-enforcer-plugin"(目标"enforce").日食警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆