如何精通“maven-enforcecer-plugin(目标”强制执行)“)被忽略,m2e”由eclipse警告? [英] How to elimate the "maven-enforcer-plugin (goal "enforce") is ignored by m2e" warning by eclipse?

查看:1552
本文介绍了如何精通“maven-enforcecer-plugin(目标”强制执行)“)被忽略,m2e”由eclipse警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用maven和eclipse m2e配置一个多模块的父子项maven项目,我使用的是eclipse Juno SR1的最新内容,它是m2e 1.2.0



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

 <插件> 
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-enforcecer-plugin< / artifactId>
< version> 1.1.1< / version>
<执行>

<! - 强制所有版本的跨过程依赖关系必须收敛。 - >
< execution>
< id> enforce< / id>
< configuration>
< rules>
< DependencyConvergence />
< / rules>
< / configuration>
< goals>
< goal> enforce< / goal>
< / goals>
< / execution>

<! - 黑色列表某些罐子 - >
< 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-enforcecer-plugin (目标执行)被m2e忽略。




  • 此消息的含义是什么?

  • 如何配置东西以摆脱这个消息?

  • 我需要配置eclipse项目设置或pom.xml设置吗?


解决方案

eclipse maven插件运行一个项目pom.xml文件,以便了解如何配置maven项目,并将maven pom.xml配置转换为eclipse配置。一个pom.xml可以引用任意数量的maven插件,并且这些插件中的每一个都有可能泄漏内存,也可能会对eclipse有害。所以默认情况下,m2e eclipse插件会忽略任何maven插件,除非这些maven插件有一个特殊的m2e插件连接器,告诉m2e如何将maven插件集成到eclipse中。总而言之,m2e是针对一个错误的maven插件来捍卫eclipse JVM进程,通过说每个maven插件需要一个m2e连接器来连接maven和eclipse之间。



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

 <建立> 
< pluginManagement>
< plugins>
< plugin>
< groupId> org.eclipse.m2e< / groupId>
< artifactId>生命周期映射< / artifactId>
< version> 1.0.0< / version>
< configuration>
< lifecycleMappingMetadata>
< pluginExecutions>
< pluginExecution>
< pluginExecutionFilter>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-enforcecer-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插件,设计用于在处理maven pom.xml时保存元数据与eclipse m2e插件进行通信,此信息用于告诉eclipse当eclipse运行时,使用在pom.xml中定义的maven插件做什么pom.xml作为eclipse UI的一部分。


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

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>

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

  • What is the meaning of this message?
  • How do I configure things to get rid of this message?
  • do I need to configure the eclipse project settings or the pom.xml settings?

解决方案

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.

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>

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.

这篇关于如何精通“maven-enforcecer-plugin(目标”强制执行)“)被忽略,m2e”由eclipse警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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