Maven (m2e) is not executing ant task - eclipse

I have a POM file (to be executed by Eclipse) where I want to execute a ANT task during the generate-sources phase. Based on m2e documentation, in How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds, Maven: execute antrun task during package and Where should be placed maven-compiler-plugin declaration: in <plugins> or <pluginManagement>?, I wrote my POM file in this way:
<?xml version="1.0" encoding="UTF-8"?>
<project>
...
<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-antrun-plugin</artifactId>
<versionRange>[1.8,)</versionRange>
<goals>
<goal>generate-sources</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<!-- Plugin 1 -->
</plugin>
<plugin>
<!-- Plugin to be executed during generate-sources phase. -->
</plugin>
<plugin>
<!-- Should be in the generate-sources phase after the plugin above. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>ant-test</id>
<configuration>
<task>
<echo message="ANT TEST" />
</task>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>
What I understood from my reading, is that I am asking telling to Maven the following: First ask to Eclipse plugin for Maven (m2e) to allow the maven-antrun-plugin (version 1.8 or above) to be executed during generate-sources. Next, in the generate-sources phase and after the execution of the first plugin, call the ant plugin to run the task which echo my message.
However, the messagem is not being showed. Neither when I execute just the generate-sources goal nor when I execute the install goal.
I if follow this sugestion here, and add the <phase> element inside <execution>, like here:
<executions>
<execution>
<id>ant-test</id>
*<phase>generate-sources</phase>*
<configuration>
<task>
<echo message="ANT TEST" />
</task>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
I have a Eclipse error message: Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.8:run (execution: ant-test, phase: generate-sources). Here shows a example where there is no a specific <pluginManagement> for ant plugin. But also I had no success.
So What is missing here?
Thanks,
Rafael Afonso

Actually, I discovered that the error message Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.8:run (execution: ant-test, phase: generate-sources) has no effect in the Maven execution. The message is shown with no problems. To speak the truth, I had to change the task to target, but the message continues to be displayed. May be it is just a kind m2e's bug which the only effect is annoys us.

Actually, I did the structure below, and it worked:
<build>
<plugins>
<plugin>
....
</plugin>
<plugin>
...
</plugin>
</plugins>
<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-antrun-plugin
</artifactId>
<versionRange>
[1.8,)
</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

Related

How do you generate resources for inclusion in src/main/resources without that triggering a subsequent build in eclipse

I'm trying to achieve the following in Eclipse:
When a source file changes, run an custom class that's included as part of the project dependencies, this class generates a file which needs to be placed into src/main/resources (such that it will get checked into source control by any developer working on the project). I'd even settle for /generated rather than src/main/resources.
I have the following, which seems to do the right thing, however even though the generated file is being placed into /generated, it triggers a further eclipse build, so essentially a circular loop of builds.
The following triggers m2e into action:
<pluginManagement>
<plugins>
<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,)</versionRange>
<goals>
<goal>java</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnConfiguration>false</runOnConfiguration>
<runOnIncremental>true</runOnIncremental>
</execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
The following triggers the custom class:
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>SchemaGenerator</id>
<phase>generate-sources</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>jit.SchemaGenerator</mainClass>
<arguments>
<argument>${project.basedir}/generated</argument>
<argument>schema.xml</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

Eclipse m2e connector for JAX-WS org.codehaus.mojo

I am trying to consume a webservice using wsimport goal declared at maven build. But I am facing the problem with m2e connectors. There is an error in my POM which says
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:jaxws-maven-
plugin:1.10:wsimport (execution: default, phase: generate-sources)
I have been trying to install m2e connectors but not getting them even in marketplace. There are other m2e connectors but not for JAX-WS which i need.
I have followed and tried almost each solution mentioned here but all in vain.
Although there is no problem in generating the resources. The resources are generated at build time successfully but this POM error is not allowing my project to get sync with my tomcat and each time I have to deploy the war manually to test even the little changes i make.
All this is really annoying and I need to figure out a solution to this. I am using eclipse juno in this.
Below is the POM file I am using
<build>
<finalName>home</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<phase>post-clean</phase>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
<!-- -->
<configuration>
<wsdlUrls>
<wsdlUrl>http://localhost:8080/email-service/services/EmailService?wsdl</wsdlUrl>
</wsdlUrls>
<sourceDestDir>${project.build.directory}/generated</sourceDestDir>
<verbose>true</verbose>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>additional-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/home/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/webapp/resources/props</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
There is a M2E jaxws-maven-connector GitHub project: https://github.com/trajano/jaxws-maven-connector . It worked for me with Eclipse Kepler and org.codehaus.mojo:jaxws-maven-plugin:1.12.
Choose Install new Software from the Help menu.
Add the repository https://raw.github.com/trajano/jaxws-maven-connector/master/jaxws-connector-update-site/ (see project)
Install m2e connector for jaxws and restart.
Import the Maven project or update the Eclipse Maven project configuration.
Vote for https://github.com/javaee/metro-jaxws-commons/issues/124 and get this fixed in the plugin.
Then you don't need a connector.
In the meantime you can hack this as per Archimedes Trajano's post
Though I did keep the jaxws-maven-connector updated to work with the latest M2E and jaxws-maven-plugin, I found a better way (which I also posted on http://www.trajano.net/2013/12/jaxws-maven-plugin-and-m2e/)
You add the following profile to your pom.xml file to remove the need for a non-discoverable M2E plugin.
<profile>
<id>m2e</id>
<activation>
<property>
<name>m2e.version</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>attach-wsimport-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/target/generated-sources/wsimport</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.jvnet.jax-ws-commons
</groupId>
<artifactId>
jaxws-maven-plugin
</artifactId>
<versionRange>
[2.3.1-b03,)
</versionRange>
<goals>
<goal>wsimport</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
As for the jaxws-maven-plugin configuration, just keep it to the defaults as much as possible:
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3.1-b03</version>
<configuration>
<wsdlUrls>
<wsdlUrl>http://www.webservicex.net/ConvertAcceleration.asmx?WSDL</wsdlUrl>
</wsdlUrls>
</configuration>
<executions>
<execution>
<id>wsimport</id>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
</plugin>

Run maven gwt application in hosted mode

I have created gwt maven project and I want run it so from command line I am providing:
mvn compile gwt:run -DrunTarget=com.engile.Engile/Engile.html
But In logs it shows:
ava.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1847)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at com.appops.server.data.hibernate.SessionProvider.createSessionFactory(SessionProvider.java:46)
at com.appops.server.data.hibernate.HibernateDataSourceConnector.init(HibernateDataSourceConnector.java:39)
at com.engile.server.services.ConfigurationServlet.init(ConfigurationServlet.java:45)
at com.google.inject.servlet.ServletDefinition.init(ServletDefinition.java:117)
at com.google.inject.servlet.ManagedServletPipeline.init(ManagedServletPipeline.java:82)
at com.google.inject.servlet.ManagedFilterPipeline.initPipeline(ManagedFilterPipeline.java:102)
at com.google.inject.servlet.GuiceFilter.init(GuiceFilter.java:172)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4363)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
and pom.xml includes:
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.4.0</gwtVersion>
<!-- GWT needs at least java 1.5 -->
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<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>gwt-maven-plugin</artifactId>
<!-- <versionRange>[2.5.0,)</versionRange> -->
<version>${gwtVersion}</version>
<goals>
<goal>resources</goal>
<goal>compile</goal>
<goal>i18n</goal>
<goal>generateAsync</goal>
</goals>
<configuration>
<runTarget>Engile.html</runTarget>
<hostedWebapp>${project.build.directory}/${project.build.finalName} </hostedWebapp>
<modules>
<module>com.engile.Engile</module>
</modules>
<!-- <runTarget>com.engile.Engile/Engile.html</runTarget> -->
</configuration>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<versionRange>[2.1.1,)</versionRange>
<goals>
<goal>exploded</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
</plugins>
</build>
In build path in source section I am providing outputfolder of src/main/java is target/classes and default output folder is:
engilev2_with_mavenold/src/main/webapp/WEB-INF/classes
is anything is wrong, I don't understand the webapp/classes folder and target/classes folder where java classes are compiled to ?
You have not configured gwt-maven-plugin in your build tag. You are only configuring maven-compiler-plugin and lifecycle-mapping plugin. The gwt-maven-plugin under lifecycle-plugin is only to inform eclipse to avoid invoking gwt compilation in refresh cycles,
You have the same issue in the other stackoverflow question too -
The parameters 'runTarget' for goal org.codehaus.mojo:gwt-maven-plugin:2.5.0:run are missing or invalid
Add another plugin tag in your pom.xml under buil tag after maven-compiler-plugin
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<!-- <versionRange>[2.5.0,)</versionRange> -->
<version>${gwtVersion}</version>
<goals>
<goal>resources</goal>
<goal>compile</goal>
<goal>i18n</goal>
<goal>generateAsync</goal>
</goals>
<configuration>
<runTarget>Engile.html</runTarget>
<hostedWebapp>${project.build.directory}/${project.build.finalName} </hostedWebapp>
<modules>
<module>com.engile.Engile</module>
</modules>
<!-- <runTarget>com.engile.Engile/Engile.html</runTarget> -->
</configuration>
</plugin>

The output directory for the project should be set to /gwtproject/src/main/webapp/WEB-INF/classes

I have created a GWT Maven project in Eclipse using New->Project->Maven project->GWT Eclipse plugin. It was created, but it gives some errors like
The output directory for the project should be set to /gwtproject/src/main/webapp/WEB-INF/classes
Is anything missing while configuring my project?
My pom.xml includes:
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<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>gwt-maven-plugin</artifactId>
<versionRange>[2.4.0,)</versionRange>
<goals>
<goal>resources</goal>
<goal>compile</goal>
<goal>i18n</goal>
<goal>generateAsync</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<versionRange>[2.1.1,)</versionRange>
<goals>
<goal>exploded</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
An eclipsy solution to this problem is:
Select the project in the Package Explorer.
Open the properties of the project.
Select Java Build Path
Change the default output folder
Question the life decisions you made that landed you in Eclipse.
You should do a pre-check with GWT Article WorkingWithMaven - http://code.google.com/p/google-web-toolkit/wiki/WorkingWithMaven
Also refer GWT Sample project Validation, DynaTableRf and MobileWebApp.
You need to configure the missing part in <webappDirectory> tag in the pom. I think this should solve your problem: Click Here

maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e

I have a fairly simple Maven project:
<project>
<dependencies>
...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependencies</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
However, I get the following error in m2eclipse:
Description Resource Path Location Type
maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e. pom.xml /jasperreports-test line 60 Maven Project Build Lifecycle Mapping Problem
Why do I care if m2eclipse doesn't "support" this task? Maven does, and that's all I really care about. How can I get this error in my project to go away?
It seems to be a known issue. You can instruct m2e to ignore this.
Option 1: pom.xml
Add the following inside your <build/> tag:
<pluginManagement>
<plugins>
<!-- Ignore/Execute plugin execution -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<!-- copy-dependency plugin -->
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins></pluginManagement>
You will need to do Maven... -> Update Project Configuration on your project after this.
Read more: http://wiki.eclipse.org/M2E_plugin_execution_not_covered#m2e_maven_plugin_coverage_status
Option 2: Global Eclipse Override
To avoid changing your POM files, the ignore override can be applied to the whole workspace via Eclipse settings.
Save this file somewhere on the disk: https://gist.github.com/maksimov/8906462
In Eclipse/Preferences/Maven/Lifecycle Mappings browse to this file and click OK:
This is a problem of M2E for Eclipse M2E plugin execution not covered.
To solve this problem, all you got to do is to map the lifecycle it doesn't recognize and instruct M2E to execute it.
You should add this after your plugins, inside the build. This will remove the error and make M2E recognize the goal copy-depencies of maven-dependency-plugin and make the POM work as expected, copying dependencies to folder every time Eclipse build it. If you just want to ignore the error, then you change <execute /> for <ignore />. No need for enclosing your maven-dependency-plugin into pluginManagement, as suggested before.
<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-dependency-plugin</artifactId>
<versionRange>[2.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
If copy-dependencies, unpack, pack, etc., are important for your project you shouldn't ignore it. You have to enclose your <plugins> in <pluginManagement> tested with Eclipse Indigo SR1, maven 2.2.1
To make it work, instead of ignoring it, you can install the m2e connector for the maven-dependency-plugin:
https://github.com/ianbrandt/m2e-maven-dependency-plugin
Here is how you would do it in Eclipse:
go to Window/Preferences/Maven/Discovery/
enter Catalog URL: http://download.eclipse.org/technology/m2e/discovery/directory-1.4.xml
click Open Catalog
choose the m2e-maven-dependency-plugin
enjoy
Despite answer from CaioToOn above, I still had problems getting this to work initially.
After multiple attempts, finally got it working.
Am pasting my final version here - hoping it will benefit somebody else.
<build>
<plugins>
<!--
Copy all Maven Dependencies (-MD) into libMD/ folder to use in classpath via shellscript
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/libMD</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<!--
Above maven-dependepcy-plugin gives a validation error in m2e.
To fix that, add the plugin management step below. Per: http://stackoverflow.com/a/12109018
-->
<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-dependency-plugin</artifactId>
<versionRange>[2.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
I had the same problem when trying to load Hadoop project in eclipse. I tried the solutions above, and I believe it might have worked in Eclipse Kepler... not even sure anymore (tried too many things).
With all the problems I was having, I decided to move on to Eclipse Luna, and the solutions above did not work for me.
There was another post that recommended changing the ... tag to package. I started doing that, and it would "clear" the errors... However, I start to think that the changes would bite me later - I am not an expert on Maven.
Fortunately, I found out how to remove all the errors. Go to Window->Preferences->Maven-> Error/Warnings and change "Plugin execution not covered by lifecycle..." option to "Ignore". Hope it helps.
I know this is old post but I struggled today with this problem also and I used template from this page: http://maven.apache.org/plugins/maven-dependency-plugin/usage.html
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>[ groupId ]</groupId>
<artifactId>[ artifactId ]</artifactId>
<version>[ version ]</version>
<type>[ packaging ]</type>
<classifier> [classifier - optional] </classifier>
<overWrite>[ true or false ]</overWrite>
<outputDirectory>[ output directory ]</outputDirectory>
<destFileName>[ filename ]</destFileName>
</artifactItem>
</artifactItems>
<!-- other configurations here -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
[...]
</project>
and everything works fine under m2e 1.3.1.
When I tried to use
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependencies</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
I also got m2e error.
Another option is to navigate to problems tab, right click on error, click apply quick fix. The should generate the ignore xml code and apply it .pom file for you.