How do I prevent org.eclipse.m2e lifecycle-mapping in my maven pom file?
-
11-04-2022 - |
Question
I have a maven project and we usually edit it with Eclipse. Some developers keep adding information about the org.eclipse.m2e lifecycle-mapping plugin to the pluginManagement section of my nice-and-clean pom.xml. I'd rather it was added to the eclipse workspace instead.
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
...
I'd like to prevent that and talking to is an option, but I'd much rather combine it with automatic enforcement.
I use the "maven-enforcer-plugin" for several other checks and it looks like the obvious place to go.
I've tried the "banned plugins" rule, but that one only reacts to the build->plugins section, not the builds->pluginManagement->plugins
I also tried the "evaluate beanshell", but was unable to figure out how to reach the correct section in the pom through properties
I'd rather not write a custom rule, if it's already supported by the existing rules.
Do any of you know how to do this?
No correct solution