How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds
Asked Answered
S

32

1008

I am trying to work with Spring Data and Neo4j. I started by trying to follow this guide linked to by the main site. In particular I based my pom.xml off of the "Hello, World!" example file. Here is a snip from my pom.xml for the plugin that is causing the issues...

<plugin>
<!-- Required to resolve aspectj-enhanced class features -->
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.0</version>
    <configuration>
        <outxml>true</outxml>
        <aspectLibraries>
            <aspectLibrary>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aspects</artifactId>
            </aspectLibrary>
            <aspectLibrary>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-neo4j</artifactId>
            </aspectLibrary>
        </aspectLibraries>
        <source>1.6</source>
        <target>1.6</target>
    </configuration>
    <executions>
        <!-- ERROR HERE IN ECLIPSE SEE BELOW FOR FULL MESSAGE -->
        <execution>
            <goals>
                <goal>compile</goal>
                <goal>test-compile</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${aspectj.version}</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjtools</artifactId>
            <version>${aspectj.version}</version>
        </dependency>
    </dependencies>
</plugin>

The error I am seeing is:

 Multiple annotations found at this line:
    - Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:aspectj-maven-plugin:1.0:compile (execution: default, phase: process-classes)
    - Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:aspectj-maven-plugin:1.0:test-compile (execution: default, phase: process-classes)

I am running Eclipse 3.6.2 and m2e 0.13. I'm not a Maven expert, so please be very explanatory in your answers if possible.

I've also tried m2e 1.0.0 via this update site and still get the same error.

Signally answered 15/6, 2011 at 2:4 Comment(4)
What version of maven are you using? Spring Data (Graph) has used maven2 for its build process (mostly because docbook-plugin issues). (BTW. the spring data projects will migrate to gradle soon :)Pubis
For eclipse I am using the 3.0.3 integrated maven (whatever comes with m2e). Is all of Spring moving to gradle or just Spring Data?Signally
Forget about this working with Groovy. What a nightmare. I can't even use Indigo now because of this travesty.Budweis
Can anyone share a link to the place this new mode of operation for M2E is documented?Kehoe
S
434

What a mess. I don't remember where I found this but I had to add the following to get M2Eclipse to be happy. Even more sad is that it isn't exactly easy to understand why this tag is needed.

<build>
      ... various plugins ...

      <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse 
                m2e settings only. It has no influence on the Maven build itself. -->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>aspectj-maven-plugin</artifactId>
                                    <versionRange>[1.0,)</versionRange>
                                    <goals>
                                        <goal>test-compile</goal>
                                        <goal>compile</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

There were a number of other issues with the M2Eclipse plug-in that simply didn't work with Spring Data. In the end I disabled M2Eclipse in favor of the Apache Eclipse plug-in.

Signally answered 16/6, 2011 at 13:22 Comment(24)
What plugin repository hosts the org.eclipse.m2e:lifecycle-mapping plugin?Doggett
If your eclipse can´t find org.eclipse.m2e:lifecycle-mapping plugin it´s because you put the snippet above in the wrong plugin list in the pom, it has to go under pluginManagementSadism
FYI: If a custom plugin was specified in a profile, then I had to setup the lifecycle mapping in the same profile. Specifying it "in general" in build/pluginManagement outside of the profile that contained the plug-in did not resolve the error. Configuring the same information in the profile/build/pluginManagement did.Purapurblind
note: m2e 1.x can do this automatically as a Quick Fix from the Problems viewDeccan
@Brad: The problem with the Quick Fix is that this modifies the project files that are necessarily part of the project in the repository.Honora
Thanks: m2e offered me a 'quickfix' for a plugin it didn't recognise, which generated all the above except with <ignore /> instead of <execute />. It didn't offer the <execute /> option, which works! Maddening!Carlotacarlotta
Just want to add that I was a little confused as to where this hunk of magic goes. In my case, because I was trying to get rid of Hibernate schema and Java code generation plugin errors, I had to add this to the <build> section where I added those Hibernate plugins.Aglaia
Yes, <pluginmanagement> stuff goes under <build>. You would think the m2 page would mention this trifle.Fionafionna
Now it's getting executed but leads to an error "Execution default of goal my.maven.plugin failed", but if I use it from the console it works great. Is there any way to get a stacktrace out of this? I can't figure out what happens since it only procudes this error in the "Problem" view.Olen
I was very miffed that the spring-mvc-showcase project did not work out-of-the-box when downloaded via STS; but, this fixed my issue. Thanks.Lechner
You might have found this solution on wiki.eclipse.org/M2E_plugin_execution_not_covered.Queri
Yes it is a mess. Fortunately, with Eclipse Juno and m2e 1.3 I can open the pom.xml in Eclipse, left-click in the offending execution tag (duly marked in red) and a contextual menu offers me to add the ignore Eclipse markup.Tribal
It might be worth mentioning that this tag is needed in addition to the <plugins> tag. As a Maven newbie I spent an afternoon wondering why my plugins weren't running after applying this fix. (Or I might be misunderstanding, correct me if I'm wrong.)Bunnell
Read this to understand more about the configuration in your answer: wiki.eclipse.org/M2E_plugin_execution_not_coveredMehta
sigh this did NOT work for me (running Kepler, with maven 3.1.1). On the upside, the project builds fine with a Maven build configuration. So I guess I have that going for me.Egotism
@JBCP it was but I changed it since the higher voted answer also worked and appeared to fit better into the maven philosophySignally
@AndrewWhite - moving the definition to pluginManagement just hides the execution of the plugin from the current module. Configuring the lifecycle-mapping plugin tells Eclipse how and when to actually run the plugin. Unless you have other modules that depend on the module in question, moving the definition to pluginManagement is the same as deleting it entirely: maven.apache.org/pom.html#Plugin_ManagementZeculon
@AndrewWhite - thanks for changing it back. The higher voted answer is incorrect and misleading.Zeculon
I got the same issue with Eclipse 4.4.SR1 Luna while importing a maven project. The only fix was installing Maven Integration for Eclipse (Luna and newer) 1.5 (marketplace.eclipse.org/content/…) and re-import he project again.Marcenemarcescent
Is it really good to delcare m2e-specific things in pom? It's useless for IntelliJIdea users, isn't?Camilacamile
this answer has some details on why this is neededUsher
The central Maven repository no longer seems to have that plugin: search.maven.org/search?q=lifecycle-mappingLotion
@AndrewWhite could you mark this as the accepted answer? I know it's an old question, but extremely visited. This answer solves the problem, while the accepted one doesn't (it only hides it by actually removing the plugin...).Albin
Check David's answer which utilizes the <?m2e ..?> "New syntax for specifying lifecycle mapping metadata" feature of M2Eclipse plugin. That is the way!Equipment
P
1514

In my case of a similar problem, instead of using Andrew's suggestion for the fix, it worked simply after I introduced <pluginManagement> tag to the pom.xml in question. Looks like that error is due to a missing <pluginManagement> tag. So, in order to avoid the exceptions in Eclipse, one needs to simply enclose all the plugin tags inside a <pluginManagement> tag, like so:

<build>
    <pluginManagement>
        <plugins>
            <plugin> ... </plugin>
            <plugin> ... </plugin>
                  ....
        </plugins>
    </pluginManagement>
</build>

Once this structure is in place, the error goes away.

Peper answered 5/12, 2012 at 21:59 Comment(19)
This worked for me. My pom.xml was generated by Spring Roo and was missing the pluginManagement tag. Looks like this might be a Roo issue in some cases...Denman
Works for me too, but can anyone explain why?Iridaceous
@Andrew I think this works because m2e is not looking for plugins in pluginManagement, but only in build/plugins. In the Maven world, there is a difference between the two - the former defines "if you happen to use this plugin, here's the configuration to use", whereas the latter states "use this plugin". See this post and its top two answers.Freaky
I agree with @GreenGiant. I tried this solution but it then breaks the compilation since the aspectj plugin is not called before compilation.Hemiplegia
Worked fine with Spring Roo / STS, switched project to Eclipse Kepler, did not work there, adding this tag made it work - thanks!Finisterre
This will help you get rid of the error, but if you are using AOP you might be actually needing to install these plugins: AJDT and/or AJDT Configurator.Shrimp
I use this for eclipselink static weaving. If we add pluginManagement weaving step is not executed. I had upvoted this answer long ago as this had solved another problem of mine, but now i think this is not the right solution (cannot change the upvote as it is locked now). I used "ignore this error" option in eclipse - weaving still happens from command-line maven build.Armil
Not valid for me. Fixes the error in Eclipse, but breaks the generation of WS code with <goal> wsimport using jaxws-maven-plugin. "Permanently mark goal wsimport in pom.xml as ignored in Eclipse build" seems to add more stuff in pom.xml and fixes it for m2e.Greenwood
Errrr... It looks like that only works because it turns off all the plugins in question..... Taking them out entirely would also work, but I'm assuming they're in there for a reason? Devs should make sure they absolutely understand what they are doing with maven before using this "fix".Carrolcarroll
This is clearly the wrong solution, as it simply disables all plugins. Plugins listed under pluginManagement are no longer executed, they are simply there to provide configuration in case the plugin is used. Please don't use this fix, as it will simply create new problems for you...Eighty
I believe this works with multi-module projects in which the plugins are managed by the parent pom. In single module projects this might cause issues. I'm not sure but I assume that is why it works for some people.Mycobacterium
Just in case you have a multi-module project: in my case I was calling the plugin execution from the parent but not all child modules were using the plugin. Thus I had to enclose the <plugin><executions></executions></plugin> of the parent in <pluginManagement></pluginManagement> and I did not have to change anything in the child modules.Jacquez
Be careful with this solution. Like others comments fixes errors in Eclipse, but it disables plugins like "maven-antrun-plugin" and "grails-maven-plugin". I choosed this solution because it has a lot of positive votes, so I didn't read the warnings in the comments. Now, I cannot vote down.Integral
Adding <pluginManagement> broke Maven builds on the commandline. In the end, I marked the goal as ignored in Eclipse build, thanks @GreenwoodMcneill
For me even though this solution stopped eclipse from complaining, it still broke during the compilation time. I believe the answer that suggesst configuring this plugin with m2e is more deserved to show on top, since I tried that and everything works after that, my plugin will run every time when I call Maven update.Ringside
Note everyone saying this disabled all plugins: If you simply enclose all plugins by <pluginManagement> then yes, you effectively turn most plugins off since you're only configuring them, not actually calling them. You need a separate <plugins>...</plugins> under build with a <plugin><groupId>...</groupId><artifactId>...</artifactId></plugin> for each plugin you want to run (without any config, since you put the config in the pluginmgmt). This makes sure the plugin is actually called during the build.Enravish
This is not a solution. It only ignores the error by not showing it anymore. The only solution is to install the missing plugin.Pardew
Not valid one...It remove error from eclipse only...My avro plugin not working after adding this pluginmanagement....after removing pluginmanagement,It only show error in eclipse but pom working fine....Niel
It did not work for me.Wolfie
S
434

What a mess. I don't remember where I found this but I had to add the following to get M2Eclipse to be happy. Even more sad is that it isn't exactly easy to understand why this tag is needed.

<build>
      ... various plugins ...

      <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse 
                m2e settings only. It has no influence on the Maven build itself. -->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>aspectj-maven-plugin</artifactId>
                                    <versionRange>[1.0,)</versionRange>
                                    <goals>
                                        <goal>test-compile</goal>
                                        <goal>compile</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

There were a number of other issues with the M2Eclipse plug-in that simply didn't work with Spring Data. In the end I disabled M2Eclipse in favor of the Apache Eclipse plug-in.

Signally answered 16/6, 2011 at 13:22 Comment(24)
What plugin repository hosts the org.eclipse.m2e:lifecycle-mapping plugin?Doggett
If your eclipse can´t find org.eclipse.m2e:lifecycle-mapping plugin it´s because you put the snippet above in the wrong plugin list in the pom, it has to go under pluginManagementSadism
FYI: If a custom plugin was specified in a profile, then I had to setup the lifecycle mapping in the same profile. Specifying it "in general" in build/pluginManagement outside of the profile that contained the plug-in did not resolve the error. Configuring the same information in the profile/build/pluginManagement did.Purapurblind
note: m2e 1.x can do this automatically as a Quick Fix from the Problems viewDeccan
@Brad: The problem with the Quick Fix is that this modifies the project files that are necessarily part of the project in the repository.Honora
Thanks: m2e offered me a 'quickfix' for a plugin it didn't recognise, which generated all the above except with <ignore /> instead of <execute />. It didn't offer the <execute /> option, which works! Maddening!Carlotacarlotta
Just want to add that I was a little confused as to where this hunk of magic goes. In my case, because I was trying to get rid of Hibernate schema and Java code generation plugin errors, I had to add this to the <build> section where I added those Hibernate plugins.Aglaia
Yes, <pluginmanagement> stuff goes under <build>. You would think the m2 page would mention this trifle.Fionafionna
Now it's getting executed but leads to an error "Execution default of goal my.maven.plugin failed", but if I use it from the console it works great. Is there any way to get a stacktrace out of this? I can't figure out what happens since it only procudes this error in the "Problem" view.Olen
I was very miffed that the spring-mvc-showcase project did not work out-of-the-box when downloaded via STS; but, this fixed my issue. Thanks.Lechner
You might have found this solution on wiki.eclipse.org/M2E_plugin_execution_not_covered.Queri
Yes it is a mess. Fortunately, with Eclipse Juno and m2e 1.3 I can open the pom.xml in Eclipse, left-click in the offending execution tag (duly marked in red) and a contextual menu offers me to add the ignore Eclipse markup.Tribal
It might be worth mentioning that this tag is needed in addition to the <plugins> tag. As a Maven newbie I spent an afternoon wondering why my plugins weren't running after applying this fix. (Or I might be misunderstanding, correct me if I'm wrong.)Bunnell
Read this to understand more about the configuration in your answer: wiki.eclipse.org/M2E_plugin_execution_not_coveredMehta
sigh this did NOT work for me (running Kepler, with maven 3.1.1). On the upside, the project builds fine with a Maven build configuration. So I guess I have that going for me.Egotism
@JBCP it was but I changed it since the higher voted answer also worked and appeared to fit better into the maven philosophySignally
@AndrewWhite - moving the definition to pluginManagement just hides the execution of the plugin from the current module. Configuring the lifecycle-mapping plugin tells Eclipse how and when to actually run the plugin. Unless you have other modules that depend on the module in question, moving the definition to pluginManagement is the same as deleting it entirely: maven.apache.org/pom.html#Plugin_ManagementZeculon
@AndrewWhite - thanks for changing it back. The higher voted answer is incorrect and misleading.Zeculon
I got the same issue with Eclipse 4.4.SR1 Luna while importing a maven project. The only fix was installing Maven Integration for Eclipse (Luna and newer) 1.5 (marketplace.eclipse.org/content/…) and re-import he project again.Marcenemarcescent
Is it really good to delcare m2e-specific things in pom? It's useless for IntelliJIdea users, isn't?Camilacamile
this answer has some details on why this is neededUsher
The central Maven repository no longer seems to have that plugin: search.maven.org/search?q=lifecycle-mappingLotion
@AndrewWhite could you mark this as the accepted answer? I know it's an old question, but extremely visited. This answer solves the problem, while the accepted one doesn't (it only hides it by actually removing the plugin...).Albin
Check David's answer which utilizes the <?m2e ..?> "New syntax for specifying lifecycle mapping metadata" feature of M2Eclipse plugin. That is the way!Equipment
C
276

In Eclipse Luna 4.4.0, you can chose to ignore this error in preferences

Window > Preferences > Maven > Errors/Warnings > Plugin execution not covered by lifecycle configuration. Select Ignore / Warning / Error as you wish.

Also, in the quick fix (Ctrl + 1) for this error, it gives an option to mark goal as ignored in Eclipse build in Eclipse preferences (experimental)

This is a cleaner way, as it doesn't modify your pom.xml.

You will need to do a Maven > Update project to fix the same error in any other project as well.


In STS(Spring-tool-suite), you can choose to ignore this error in preferences

Window > Preferences > Maven > Errors/Warnings > Plugin execution not covered by life-cycle configuration. Select Ignore / Warning / Error as your wish. Then. Right click the project click Maven and update the project then error will gone.

Condor answered 11/12, 2014 at 19:13 Comment(6)
Perfect. Worked for me flawlessly. Thanks for sharing.Selry
I used it too in eclipse 2020-03, I'm not sure why the error came out this time when I imported the project, I did it before at least 4 times on other computers without any problem. I'm new to eclipse I have to say that, i'm still understanding how it build things, which of them, and when :-DIndic
This is the right answer. Thanks. I'am using Red Hat CodeReady Studio which is Eclipse based tool.Sphygmograph
How is this a fix? Instead of Eclipse complaining that it's not generating my source code (by flagging a line in POM.XML with a red X and the error message "Plugin execution not covered by lifecycle configuration"), with this change Eclipse just silently doesn't generate my source code.Drawee
This just DISABLES the plugin!!Heresiarch
The quickfix option is the best I think. It will create or edit the file .metadata\.plugins\org.eclipse.m2e.core of your eclipse workspace. A manual solution was provided here https://mcmap.net/q/54342/-plugin-execution-not-covered-by-lifecycle-configuration-org-apache-maven-plugins-maven-toolchains-plugin-1-1-toolchain. This "quickfix" solution is perfect for me because you don't need to edit project sources because of an IDE problem.Pendleton
G
231

Suggested solution from Eclipse m2e documentation:

  1. Use quick-fix on the error in pom.xml and select Permanently mark goal run in pom.xml as ignored in Eclipse build - this will generate the required boilerplate code for you.

  2. To instruct Eclipse to run your plugin during build - just replace the <ignore/> tag with <execute/> tag in the generated configuration:

     <action>
         <execute/>
     </action>
    

Alternatively you can instruct Eclipse to run the plugin on incremental builds as well:

    <action>
        <execute>
            <runOnIncremental>true</runOnIncremental>
        </execute>
    </action>
Garrote answered 11/2, 2013 at 10:8 Comment(7)
Also you can add <runOnIncremental>false|true</runOnIncremental> inside the execute tag, to make eclipse call this maven plugin on incremental builds.Capparidaceous
This solution worked for me as well, but it was not necessary to execute step 2) of the proposed workaround.Nayarit
If you don't mark them as "execute", the eclipse build won't run those plugin executions, but it might work as well.Heraldic
Note that you can also add it globally to Eclipse with Permanently mark goal run in eclipse preferences and change <ignore> to <execute> in Eclipse preferences > Maven > Lifecycle Mappings > Open workspace lifecycle mappings metadata.Zygapophysis
I had the same issue as the original poster, Mr. White with his org.codehaus errors, while importing the spring-mvc-showcase into Eclipse Oxygen today. Quick Fix alone did the trick, no manual editing of any kind, and it pulled AspectJ and AJDT just fine on its own to resolve the error.Slacks
I like this solution because you don`t have to mess with the POM (which we use in JBoss Dev Studio (Eclipse), command line and CI in the cloud. The only difference I can add (my error was showing for the toolchains plugin) is that the wording for my Quick Fix was "Mark goal toolchain as ignored in eclipse preferences"Rockey
Thank you, this is the actual solution. Adding the <pluginManagement> tag only disables the plugin.Arezzini
D
117

See https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html .

To solve some long-standing issues, m2e 1.0 requires explicit instructions what to do with all Maven plugins bound to "interesting" phases of project build lifecycle. We call these instructions "project build lifecycle mapping" or simply "lifecycle mapping" because they define how m2e maps information from project pom.xml file to Eclipse workspace project configuration and behaviour during Eclipse workspace build.

Project build lifecycle mapping configuration can be specified in project pom.xml, contributed by Eclipse plugins and there is also default configuration for some commonly used Maven plugins shipped with m2e. We call these "lifecycle mapping metadata sources". m2e will create error marker like below for all plugin executions that do not have lifecycle mapping in any of the mapping metadata sources.

Plugin execution not covered by lifecycle configuration:
org.apache.maven.plugins:maven-antrun-plugin:1.3:run
   (execution: generate-sources-input, phase: generate-sources)

m2e matches plugin executions to actions using combination of plugin groupId, artifactId, version range and goal. There are three basic actions that m2e can be instructed to do with a plugin execution -- ignore, execute and delegate to a project configurator.

Doorframe answered 25/6, 2011 at 0:57 Comment(12)
That is an explanation of the problem, not a solution at least not one that I can take and work with.Signally
You gave the answer yourself, and it can be found on the page I linked to. If find it more important to understand what an error means (and then easily find how to fix it) than to blindly copy/paste some snippets. "Science without conscience is but the ruin of the soul." (François Rabelais)Doorframe
hmm, that wiki page has been updating since I posted my answer and also since I last read it.Signally
Sorry, but I agree with Andrew, use this plugin is far more complicated then it should be. I was starting a new application and first i though the problem was my pow file, just when I try a pow that I know it should work, I saw that this problem was caused by m2e. Sorry guys, but I think a good pow file should just Work. Nobody knows everything about everything, i just want to use this plugin dont want know how it works.Rogers
I have to agree that this has gone the opposite way of the Maven manifesto (so to speak). It makes a simple thing so complex that even reading all about it, I can't get it to work half the time. I would much, much rather have to deal with some maven idiosyncrasy than deal with plugins not binding to lifecycle phases when they are supposed to. If this is an interim solution, then fine... but get it fixed because it's broken now.Kestrel
Apparently this particular problem is actually a plugin problem. See: wiki.eclipse.org/M2E_compatible_maven_plugins Try updating the plugin version. However, I have to say that maven should not be crapping out this easily for the legacy plugins... possibly printing a huge warning, but not crapping out.Kestrel
It's not Maven that's crapping out. Builds from the command line work. It's the m2eclipse plugin (built by the Eclipse folk) that is spewing out the error. I think the problem is that Maven has a different build lifecycle than Eclipse so they need you to make an explicit mapping. That's a great shame as it means you can apparently never use POM's as they are. You always have to add this mapping....Branks
Interesting. So, am I right in thinking that we should not be modifying pom, but do it on the Eclipse level (e.g. add custom lifecycle-metadata-mapping.xml). In case of someone uses ItelliJIdea, they probably don't want to see m2e-specific plugin declaration in pom....Camilacamile
From the link: “If you have multiple Eclipse workspaces and/or work in a team, it is easy to get workspace-level configuration out-of-sync. This is unlikely to cause any confusion for <ignore /> mappings, but for <execute /> and <configurator /> mappings configuration in pom.xml or maven-plugin is strongly recommended.” – so yes and no. Ideally, plugins should provide their own lifecycle-mapping-metadata.xml (or an Eclipse configurator, as an Eclipse plugin) so that as a user you don't have anything to configure.Doorframe
Try and understand all the jargon pointed to by Thomas Broyer's link. Gees, you have to be an Eclipse plug-in expert.I wouldn't know where to begin.Scrivings
Reading and struggling w/ this lifecycle nonsense, I thought that either Eclipse should be smarter or Maven is not designed with IDEs in mind. Thomas Broyer provided a good under the hood explanation but do I really want to become an expert in Maven to run the damn thing?Calculated
Of course the IDE build cycles cannot be the same as for batch built.Of course you NEED to understand maven basics to use maven. Of course you need to understand maven because horrid people like me keep configuring our projects with maven. Of course you need to understand the very basic info Thomas Broyer is expressing. And finally - OF COURSE you need to understand the problem first before the solution !! Duurh !.Vivyanne
N
36

Note that the M2Eclipse (m2e) version 1.7.0 available in today's Eclipse Neon release train supports new syntax for specifying lifecycle mapping metadata. As a result boilerplate like this (here we're telling m2e to ignore the goal):

<pluginManagement>
  <plugins>
    <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
    <plugin>
      <groupId>org.eclipse.m2e</groupId>
      <artifactId>lifecycle-mapping</artifactId>
      <version>1.0.0</version>
      <configuration>
        <lifecycleMappingMetadata>
          <pluginExecutions>
            <pluginExecution>
              <pluginExecutionFilter>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <versionRange>[1.5.0,)</versionRange>
                <goals>
                  <goal>exec</goal>
                </goals>
              </pluginExecutionFilter>
              <action>
                <ignore></ignore>
              </action>
            </pluginExecution>
          </pluginExecutions>
        </lifecycleMappingMetadata>
      </configuration>
    </plugin>
  </plugins>
</pluginManagement>

can be replaced with a single line in the plugin's execution node:

<?m2e ignore?>

enter image description here

See the release notes for details.

Narrowminded answered 22/6, 2016 at 21:25 Comment(1)
By far the best and cleanest answer to this problem. To anyone wondering how it works: it utilizes the xml processing instructions feature. w3.org/TR/xml/#sec-piEquipment
V
33

Change the Maven preferences for plugin execution from error to ignore

Venezuela answered 21/9, 2016 at 18:59 Comment(1)
Really strongly recommend that this be the new accepted answer. Many other solutions will stop Maven from executing the plugin entirely during the specified build step, which is rarely what the user wants. This is usually a configuration issue, not an actual error. The Eclipse default ought to be Warning, not Error.Neuro
I
31

m2e 0.13 introduce a m2e connectors and m2e Market Place to extend m2e features. It's like the old m2e-extras repository.

You can access the m2e market place from the preferences: Preferences>Maven>Discovery>Open Catalog. Installing WTP integration solved most plugin issues for me.

Incongruent answered 23/6, 2011 at 14:43 Comment(6)
I don't see "WTP integration" in the list. Are you using some non-default catalog?Electrocautery
I'm using the default catalog but you're right: I don't see it anymore.Incongruent
community.jboss.org/en/tools/blog/2011/06/23/…. See update 2, anyway +1 for big messUnderbody
as of Nov 2011, m2e wtp can be found in Eclipse MarketplaceBeekeeper
It works, add update site from this url: download.jboss.org/jbosstools/updates/m2eclipse-wtpWilhite
"Discovery" is not present in Eclipse 4.3 Kepler.Burgomaster
H
21

As an addendum to the previous answers -- there's a workaround I just discovered for if you can't or don't want to add all this boilerplate to your project POM. If you look in the following location:

{Eclipse_folder}/plugins/org.eclipse.m2e.lifecyclemapping.defaults_{m2e_version}

You should find a file called lifecycle-mapping-metadata.xml where you can make the same changes described in the other answers and in M2E plugin execution not covered.

Husband answered 16/5, 2012 at 18:44 Comment(1)
You can also edit the WORKSPACE/.metadata/.plugins/org.eclipse.m2e.core/lifecycle-mapping-metadata.xml file instead of fiddling with the jars. More details can be found under Preferences > Maven > Lifecycle Mappings. Also if you select the quick-fix "Mark goal xxxxx as ignored in Eclipse build in Eclipse preferences (experimental)" it would add all the required changes to the above file.Salpiglossis
O
18

I had the same problem with Eclipse v3.7 (Indigo) and m2eclipse as my Maven plugin. The error was easily solved by explicitly stating the execution phase within the plugin definition. So my pom looks like this:

<project>
    ...
    <build>
        ...
        <plugins>
            <plugin>

                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>1.0</version>

                <configuration>
                    <timestampFormat>yyyy-MM-dd_HH-mm-ss</timestampFormat>
                </configuration>

                <executions>
                    <execution>
                        *<phase>post-clean</phase>*
                        <goals>
                            <goal>create-timestamp</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        ...
Osbourne answered 14/9, 2011 at 7:15 Comment(0)
R
10
  1. Go to Help > Install New Software...
  2. Use this software repository

    Make sure "Contact all update sites during install to find required software" is checked.

  3. Install the AJDT m2e Configurator

Source: Upgrading Maven integration for SpringSource Tool Suite 2.8.0 (Andrew Eisenberg)

This should automatically install ADJT if you don't have it installed, but if it doesn't, install AspectJ Development Tools (ADJT) first from "Indigo update site" (according to your Eclipse version).

More info on AspectJ Development Tools site.

Remissible answered 12/11, 2011 at 17:29 Comment(2)
i tried that but i got the error: Missing requirement: Maven Integration for AJDT (Optional) 0.13.0.201107281640 (org.maven.ide.eclipse.ajdt.feature.feature.group 0.13.0.201107281640) requires 'org.eclipse.ajdt.feature.group 1.5.0' but it could not be foundManservant
Msaleh, try my revised answerRemissible
N
9

I've had the same problem with indigo and a project that needs to generate Java sources from XSD.
I could fix it by supplying the missing life-cycle mapping, as described on this page

Nutting answered 1/7, 2011 at 9:14 Comment(0)
Z
9

I fixed it following blog post Upgrading Maven integration for SpringSource Tool Suite 2.8.0.

Follow the advice on the section called "Uh oh…my projects no longer build". Even when it's intended for SpringSource Tool Suite I used it to fix a regular Eclipse installation. I didn't have to modify my pom files.

Zoography answered 21/10, 2011 at 16:7 Comment(1)
The last resource it to revert to an older version of m2e or the IDE you use.Zoography
M
9

Goto workspace/rtc-ws/.metadata/.plugins/org.eclipse.m2e.core/lifecycle-mapping-metadata.xml then create lifecycle-mapping-metadata.xml file and paste below and reload configuration as below

If you are using Eclipse 4.2 and have troubles with mapping and won't put mess into yours pom.xml create new file lifecycle-mapping-metadata.xml configure it in Windows -> Preferences -> Lifecycle mapping (don't forget press Reload workspace lifecycle mappings metadata after each change of this file!). Here is example based on eclipse/plugins/org.eclipse.m2e.lifecyclemapping.defaults_1.2.0.20120903-1050.jar/lifecycle-mapping-metadata.xml

<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
    <pluginExecutions>
        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <goals>
                    <goal>create-timestamp</goal>
                </goals>
                <versionRange>[0.0,)</versionRange>
            </pluginExecutionFilter>
            <action>
                <ignore />
            </action>
        </pluginExecution>

        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <goals>
                    <goal>list</goal>
                </goals>
                <versionRange>[0.0,)</versionRange>
            </pluginExecutionFilter>
            <action>
                <ignore />
            </action>
        </pluginExecution>

        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.zeroturnaround</groupId>
                <artifactId>jrebel-maven-plugin</artifactId>
                <goals>
                    <goal>generate</goal>
                </goals>
                <versionRange>[0.0,)</versionRange>
            </pluginExecutionFilter>
            <action>
                <ignore />
            </action>
        </pluginExecution>

        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <goals>
                    <goal>compile</goal>
                </goals>
                <versionRange>[0.0,)</versionRange>
            </pluginExecutionFilter>
            <action>
                <ignore />
            </action>
        </pluginExecution>

        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <goals>
                    <goal>copy-dependencies</goal>
                    <goal>unpack</goal>
                </goals>
                <versionRange>[0.0,)</versionRange>
            </pluginExecutionFilter>
            <action>
                <ignore />
            </action>
        </pluginExecution>

        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <versionRange>[1.7,)</versionRange>
                <goals>
                    <goal>run</goal>
                </goals>
            </pluginExecutionFilter>
            <action>
                <ignore />
            </action>
        </pluginExecution>


        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <versionRange>[2.8,)</versionRange>
                <goals>
                    <goal>check</goal>
                </goals>
            </pluginExecutionFilter>
            <action>
                <ignore />
            </action>
        </pluginExecution>

    </pluginExecutions>
</lifecycleMappingMetadata>
Mcconnell answered 18/6, 2013 at 11:46 Comment(0)
I
6

This error happens also on neon because of missing m2e connector. Solution: hover error and select - Discover new m2e connectors.

It will install new connector and that is it.

Intratelluric answered 20/4, 2017 at 0:41 Comment(1)
This worked for me as well. Took about 15 minutes but after installing the extension, my builds no longer have this lifecycle error.Hildick
V
5

Use m2e 0.12, last version from Sonatype.

Villiers answered 22/11, 2011 at 12:46 Comment(0)
A
4

I had the exact same problem after updating m2e and solved it by reinstalling Maven Integration for Eclipse WTP.

As it turns out, I uninstalled it trying to update m2e from version 0.x to 1.x

Australorp answered 21/12, 2011 at 20:11 Comment(0)
G
4

I was using

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
    <execution>
        <id>runSomeAntTasks</id>
        <phase>test-compile</phase>
        .
        .
        <goals>
            <goal>run</goal>
        </goals>
    </execution>
</executions>

and changed it to

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
    <execution>
        <id>runSomeAntTasks</id>
        <phase>integration-test</phase>
        .
        .
        
        <goals>
            <goal>run</goal>
        </goals>
    </execution>
</executions>

and the error went away. Maybe it's not recommended to bind an execution to the test-compile phase so finding a different phase might be an alternate solution to adding plugin-management configuration to the maven lifecycle.

Greenbelt answered 3/5, 2012 at 16:38 Comment(0)
Q
4

Where find WTP:

Mouse down on < plugin > in pom.xml and 'Discover new m2e connectors'.

I installed them all what are default checked and it works.

Quits answered 25/7, 2014 at 23:43 Comment(0)
C
3

Changing

<artifactId>aspectj-maven-plugin</artifactId>
<version>1.2</version>

into

<artifactId>aspectj-maven-plugin</artifactId>
<version>1.3</version>

solved the problem for me.

Croupier answered 25/10, 2011 at 21:4 Comment(0)
U
3

I had this problem today. I was using STS 3.4 with its bundled Roo 1.2.4. Later I tried with Eclipse Kepler and Roo 1.2.5, same error.

I've changed my pom.xml adding pluginTemplates tag after build and before plugins declaration but didn't work.

What made the magic for me:

  • Using jdk 1.7.0_51
  • Downloaded Roo 1.2.5
  • Downloaded Maven 3.2.1 (if not, when executes "perform eclipse" this error appears "error=2, no such file or directory")
  • Configured JDK, Roo and Maven bin directories on my PATH:

    export PATH=/opt/jdk1.7.0_51/bin:$PATH export PATH=/opt/spring-roo-1.2.5.RELEASE/bin:$PATH export PATH=/opt/apache-maven-3.2.1/bin:$PATH

Made my configuration as following: (http://docs.spring.io/spring-roo/reference/html/beginning.html)

$ mkdir hello 
$ cd hello
$ roo.sh
roo> project --topLevelPackage com.foo
roo> jpa setup --provider HIBERNATE --database HYPERSONIC_PERSISTENT 
roo> web mvc setup
roo> perform eclipse

Open with Eclipse (nothing of STS, but I guess it works): Import -> Existing Projects into Workspace

Unseasoned answered 10/3, 2014 at 20:24 Comment(0)
H
2

Instead of messing up your pom file, I would suggest you to go to Show ViewMarkers in Eclipse, select and delete the markers of appropriate errors.

Hildie answered 29/10, 2013 at 10:48 Comment(1)
Grrr, I hate having to pick between two evils. Adding scores of lines of garbage to pom = bad. Your way = also bad, because it keeps reappearing (every time you save the pom) and I have to tell everyone that this is ok.Marienthal
O
2

I encountered exact the same problem with maven thrift plugin. Here's my solution which requires no need to mess up your pom.xml:

  1. Use command line maven utility mvn

    mvn eclipse:eclipse

    to create a eclipse project

  2. Import the project in eclipse. Remember to use

    File > Import > General > Existing Projects into Workspace

    to add the project into your workspace.

This should fix the problem.

Oren answered 12/6, 2014 at 16:32 Comment(0)
C
2

This answer is just as good the top plugin-management answer above (which is to say, it's terrible).

Just delete all the offending xml code in the pom.

Done. Problem solved (except you just broke your maven config...).

Devs should be very careful they understand plugin-management tags before doing any of these solutions. Just slapping plugin-management around your plugins are random is likely to break the maven build for everyone else just to get eclipse to work.

Carrolcarroll answered 12/4, 2016 at 14:11 Comment(0)
T
1

I followed the GUI hint to finding any connector, and then I found AspectJ Integrator from SpringSource Team. After installation, it was settled.

Travesty answered 4/2, 2012 at 15:43 Comment(0)
C
1

I encountered this using Eclipse v4.3 (Kepler) and Maven 3.1.

The solution is to use a JDK and not a JRE for your Eclipse project. Make sure to try maven clean and test from Eclipse just to download missing JAR files.

Cabinetwork answered 21/8, 2013 at 9:35 Comment(0)
I
1

If you are using Eclipse Juno, it could be the issue of Maven Integration For Eclipse WTP . So install the same from Eclipse Market Place.

In Eclipse IDE Help>>Eclipse Market Place >> type the query wtp and it will show maven integration for eclipse WTP for Juno, install it and update the maven dependencies and enjoy

Icken answered 8/4, 2014 at 13:57 Comment(0)
E
1

I got the same error. After doing the following it went away.

  1. Right click on the project.
  2. Select Maven > Update Project...
Emilie answered 15/11, 2015 at 14:51 Comment(0)
O
1

you can suppress this error in eclipse: Window -> Preferences -> Maven -> Error/Warnings

Obstetric answered 11/10, 2016 at 13:1 Comment(0)
E
1

Most of the answers are about just ignoring error and other suggested solutions doesn't work in my case [for maven-compiler-plugin]. My solution to this problem:

  1. Go .m2 local repository in your system and find org.apache.maven.plugins directory:
    • C:\Users\[YOUR USERNAME]\.m2\repository\org\apache\maven\plugins
  2. Remove maven-compiler-plugin folder from this directory
    • You may have to close your IDE (Eclipse)
  3. After that open the IDE again and update project by Maven
    • In Eclipse right-click on the project root and choose Maven -> Update project...
Emblaze answered 22/5, 2022 at 7:37 Comment(0)
P
0

For me this was caused by AspectJ classes. I could not find a plugin under Discovery that could help. So, I fixed this by copying the org.maven.ide.eclipse.ajdt files, under plugin and feature folders, of an existing STS installation.

I know, very rude approach.

Pandean answered 12/6, 2013 at 0:9 Comment(0)
S
0

I'm meeting this problem for years... eclipse' shame. If your app is split into maven modules then you may consider removing affected modules from IDE, whenever you need to regenerate/run the plugin use maven command line with install, eclipse is then happy with prepared artifacts present in your local repository. No fiddle-around needed.

Skirret answered 10/10, 2016 at 17:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.