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
我正在使用maven和eclipse m2e配置一个多模块父子maven项目,我正在使用来自eclipse Juno SR1的最新资料,即m2e 1.2.0
the parent pom uses the enforcer plugin, so the parent pom.xml has the following in its plugin section
父pom使用enforcer插件,因此父pom.xml在其插件部分中具有以下内容
<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.
每个子项目都有一条错误消息,说明m2e忽略了maven-enforcer-plugin(目标“强制执行”)。
- 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?
- 我是否需要配置eclipse项目设置或pom.xml设置?
6 个解决方案
#1
53
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.
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。
So to get rid of the warning I added the following to my plugin management section of the parent pom.xml
因此,为了摆脱警告,我将以下内容添加到父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-mapping
is 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.
似乎org.eclipse.m2e:lifecycle-mapping是一个maven插件,用于在处理maven pom.xml时保存元数据与eclipse m2e插件进行通信,这个信息用于告诉eclipse如何定义maven插件在pom.xml中,eclipse运行pom.xml作为eclipse UI的一部分。
#2
4
From m2e version 1.4 and higher: You can integrate the needed lifecycle-configuration within the pom (parent-pom or project-pom) or you can integrate the informations into the global m2e-configuration within eclipse. Also you have some quickfix-actions for applying this changes.
从m2e 1.4及更高版本开始:您可以在pom(parent-pom或project-pom)中集成所需的生命周期配置,或者您可以将信息集成到eclipse中的全局m2e配置中。您还有一些quickfix-actions用于应用此更改。
The last option is to look for m2e-connectors or to switch over to newer versions of different maven-plugins with integrated m2e-support (e.g. for jaxb-plugins).
最后一个选项是查找m2e-connectors或切换到具有集成m2e-support的不同maven-plugins的更新版本(例如,对于jaxb-plugins)。
Here (for enforcer-plugin) I think, the definition in the pom is the easiest way.
在这里(对于enforcer-plugin)我认为,pom中的定义是最简单的方法。
See also: https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html
另见:https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html
#3
2
Just an FYI for those of you that have an issue with configuring your IDE in your build model. Keep an eye on this enhancement request currently targeted for the Kepler release:
对于那些在构建模型中配置IDE有问题的人来说,这只是一个FYI。密切关注目前针对Kepler版本的此增强请求:
Bug 350414: Store ignored m2e connectors outside project pom.xml https://bugs.eclipse.org/bugs/show_bug.cgi?id=350414
错误350414:在项目pom.xml外部存储忽略的m2e连接器https://bugs.eclipse.org/bugs/show_bug.cgi?id=350414
#4
0
For me it was similar issue
对我来说这是类似的问题
I had maven 3.0.3 and java 1.5
我有maven 3.0.3和java 1.5
and my pom had
我的pom有
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>[3.0.3,2.2.1,)</version>
</requireMavenVersion>
<requireJavaVersion>
<version>[1.7, 1.8)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
As you can see I dont really have met rules, hence I updated Java and got mvn going and I was all set. Hope this helps someone.
正如你所看到的,我真的没有遇到规则,因此我更新了Java并获得了mvn,而且我已经完成了设置。希望这有助于某人。
#5
0
Another pitfall exists when having several pluginExecutionFilters. These must be at the right spot in the pom.xml! For me it was gnarly to find as no error or warning of the displacement existed.
有几个pluginExecutionFilters时存在另一个缺陷。这些必须位于pom.xml中的正确位置!对我来说,找到没有错误或警告存在*的情况真是太可怕了。
This is the right code for having several pluginExecutionFilters:
这是拥有多个pluginExecutionFilters的正确代码:
<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>
<!-- now here follows the new filter -->
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.googlecode.maven-java-formatter-plugin</groupId>
...
#6
0
How to eliminate the “maven-enforcer-plugin (goal ”enforce“) is ignored by m2e” warning by eclipse?
如何消除“maven-enforcer-plugin(目标”强制执行“)被m2e”eclipse警告忽略?
Although the eclipse lifecycle-mapping
plugin has worked for me on other projects, I am currently working in an IntelliJ shop with my covert Eclipse and I don't want to expose myself by changing all of their pom files to include anything from group org.eclipse.m2e
.
虽然eclipse生命周期映射插件在我的其他项目中起作用,但我目前正在使用我的隐蔽Eclipse在IntelliJ商店工作,我不希望通过将所有pom文件更改为包含来自group org的任何内容来暴露自己。 eclipse.m2e。
After some experimentation, I've found that you can get this warning to not show up by changing the Lifecycle Mappings in the Maven preferences. Frankly I'm not 100% sure what this is doing but I've not seen any side effects so...
经过一些实验,我发现您可以通过更改Maven首选项中的生命周期映射来显示此警告。坦率地说,我不是100%肯定这是做什么但是我没有看到任何副作用所以...
- In Eclipse, go to: Preferences → Maven → Lifecycle Mappings.
- 在Eclipse中,转到:Preferences→Maven→Lifecycle Mappings。
-
Clicking
Open workspace lifecycle mappings metadata
which will open thelifecycle-mapping-metadata.xml
file in a tab in the background. I assume that this cooresponds to the following file under your workspace subdir:单击“打开工作区生命周期映射”元数据,该元数据将在后台的选项卡中打开lifecycle-mapping-metadata.xml文件。我假设这个cooresponds到您的工作区子目录下的以下文件:
.metadata/.plugins/org.eclipse.m2e.core/lifecycle-mapping-metadata.xml
-
Next add the following stanza to the bottom of the file inside of
<pluginExecutions>...</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>
-
Once the XML file is saved you will need to go back to the preferences window and press
Reload workspace lifecycle mappings metadata
which compiles the file somehow.保存XML文件后,您需要返回首选项窗口,然后按重新加载工作区生命周期映射元数据,以便以某种方式编译文件。
- Finally you will need to do a maven update-project on all of your projects to see the warnings go away.
- 最后,您需要对所有项目执行maven更新项目,以查看警告消失。
Hope this helps.
希望这可以帮助。
#1
53
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.
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。
So to get rid of the warning I added the following to my plugin management section of the parent pom.xml
因此,为了摆脱警告,我将以下内容添加到父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-mapping
is 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.
似乎org.eclipse.m2e:lifecycle-mapping是一个maven插件,用于在处理maven pom.xml时保存元数据与eclipse m2e插件进行通信,这个信息用于告诉eclipse如何定义maven插件在pom.xml中,eclipse运行pom.xml作为eclipse UI的一部分。
#2
4
From m2e version 1.4 and higher: You can integrate the needed lifecycle-configuration within the pom (parent-pom or project-pom) or you can integrate the informations into the global m2e-configuration within eclipse. Also you have some quickfix-actions for applying this changes.
从m2e 1.4及更高版本开始:您可以在pom(parent-pom或project-pom)中集成所需的生命周期配置,或者您可以将信息集成到eclipse中的全局m2e配置中。您还有一些quickfix-actions用于应用此更改。
The last option is to look for m2e-connectors or to switch over to newer versions of different maven-plugins with integrated m2e-support (e.g. for jaxb-plugins).
最后一个选项是查找m2e-connectors或切换到具有集成m2e-support的不同maven-plugins的更新版本(例如,对于jaxb-plugins)。
Here (for enforcer-plugin) I think, the definition in the pom is the easiest way.
在这里(对于enforcer-plugin)我认为,pom中的定义是最简单的方法。
See also: https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html
另见:https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html
#3
2
Just an FYI for those of you that have an issue with configuring your IDE in your build model. Keep an eye on this enhancement request currently targeted for the Kepler release:
对于那些在构建模型中配置IDE有问题的人来说,这只是一个FYI。密切关注目前针对Kepler版本的此增强请求:
Bug 350414: Store ignored m2e connectors outside project pom.xml https://bugs.eclipse.org/bugs/show_bug.cgi?id=350414
错误350414:在项目pom.xml外部存储忽略的m2e连接器https://bugs.eclipse.org/bugs/show_bug.cgi?id=350414
#4
0
For me it was similar issue
对我来说这是类似的问题
I had maven 3.0.3 and java 1.5
我有maven 3.0.3和java 1.5
and my pom had
我的pom有
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>[3.0.3,2.2.1,)</version>
</requireMavenVersion>
<requireJavaVersion>
<version>[1.7, 1.8)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
As you can see I dont really have met rules, hence I updated Java and got mvn going and I was all set. Hope this helps someone.
正如你所看到的,我真的没有遇到规则,因此我更新了Java并获得了mvn,而且我已经完成了设置。希望这有助于某人。
#5
0
Another pitfall exists when having several pluginExecutionFilters. These must be at the right spot in the pom.xml! For me it was gnarly to find as no error or warning of the displacement existed.
有几个pluginExecutionFilters时存在另一个缺陷。这些必须位于pom.xml中的正确位置!对我来说,找到没有错误或警告存在*的情况真是太可怕了。
This is the right code for having several pluginExecutionFilters:
这是拥有多个pluginExecutionFilters的正确代码:
<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>
<!-- now here follows the new filter -->
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.googlecode.maven-java-formatter-plugin</groupId>
...
#6
0
How to eliminate the “maven-enforcer-plugin (goal ”enforce“) is ignored by m2e” warning by eclipse?
如何消除“maven-enforcer-plugin(目标”强制执行“)被m2e”eclipse警告忽略?
Although the eclipse lifecycle-mapping
plugin has worked for me on other projects, I am currently working in an IntelliJ shop with my covert Eclipse and I don't want to expose myself by changing all of their pom files to include anything from group org.eclipse.m2e
.
虽然eclipse生命周期映射插件在我的其他项目中起作用,但我目前正在使用我的隐蔽Eclipse在IntelliJ商店工作,我不希望通过将所有pom文件更改为包含来自group org的任何内容来暴露自己。 eclipse.m2e。
After some experimentation, I've found that you can get this warning to not show up by changing the Lifecycle Mappings in the Maven preferences. Frankly I'm not 100% sure what this is doing but I've not seen any side effects so...
经过一些实验,我发现您可以通过更改Maven首选项中的生命周期映射来显示此警告。坦率地说,我不是100%肯定这是做什么但是我没有看到任何副作用所以...
- In Eclipse, go to: Preferences → Maven → Lifecycle Mappings.
- 在Eclipse中,转到:Preferences→Maven→Lifecycle Mappings。
-
Clicking
Open workspace lifecycle mappings metadata
which will open thelifecycle-mapping-metadata.xml
file in a tab in the background. I assume that this cooresponds to the following file under your workspace subdir:单击“打开工作区生命周期映射”元数据,该元数据将在后台的选项卡中打开lifecycle-mapping-metadata.xml文件。我假设这个cooresponds到您的工作区子目录下的以下文件:
.metadata/.plugins/org.eclipse.m2e.core/lifecycle-mapping-metadata.xml
-
Next add the following stanza to the bottom of the file inside of
<pluginExecutions>...</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>
-
Once the XML file is saved you will need to go back to the preferences window and press
Reload workspace lifecycle mappings metadata
which compiles the file somehow.保存XML文件后,您需要返回首选项窗口,然后按重新加载工作区生命周期映射元数据,以便以某种方式编译文件。
- Finally you will need to do a maven update-project on all of your projects to see the warnings go away.
- 最后,您需要对所有项目执行maven更新项目,以查看警告消失。
Hope this helps.
希望这可以帮助。