Artifact has not been packaged yet - eclipse

I am letting Maven copy some dependency files into a specific location for a GWT project. The maven-dependency-plugin does the job and so far it works. The only Problem is that I'm getting an error from Eclipse that says:
Artifact has not been packaged yet. When used on reactor artifact, copy should be executed after packaging: see MDEP-187.
I have tried to change the <phase> but that did not work. How can I get rid of that error and why is it there because Maven builds as intended.
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/war/WEB-INF/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

I got the same error and I solved this issue with a workaround. I have compiled and installed the project with Maven in a console outside Eclipse IDE. After I have refreshed the project inside Eclipse IDE and error has disappeared.

There is a solution similar to s1moner3d answer which doesn't require changes to pom.xml file.
Go to Window > Preferences > Maven > Lifecycle Mappings and click on the Open workspace lifecycle mappings metadata button.
Than add pluginExecution entry like in the code below. If the file is empty, copy the entire content below. You might need to change versionRange.
<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>2.10</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
In order for this to take effect go back to Preferences and click Reload workspace lifecycle mappings metadata. Update Maven projects and / or rebuild. The error should be gone.
Useful if you cannot or don't want to modify pom.xml for any reasons but want to stop your Eclipse m2e from executing particular goal of a particular plugin.

I solved by setting the plugin phase to prepare-package. I know it's still a workaround, but I think it's cleaner than compile externally.
<plugins>
[...]
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
[YOUR_CONFIGURATION]
</configuration>
</execution>
</executions>
</plugin>
[...]
</plugins>
EDIT:
This is not fully solving: sometimes it works, other times not.
The final solution is to use the Lifecycle Mapping Maven Dummy Plugin through an eclipse-only maven profile:
<profile>
<id>only-eclipse</id>
<activation>
<property>
<name>m2e.version</name>
</property>
</activation>
<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-dependency-plugin</artifactId>
<versionRange>${maven-dependency-plugin.version}</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>

I had to wrap plugins tag under pluginManagement to make the error go away.
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>../../lib/</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>

I used this answer to fix the problem. That 2017 update to m2eclipse means you don't need to use the pluginManagment xml as in s1moner3d's answer, and so that gets rid of the "POM not found" warning I got for the 'lifecycle-mapping' artifactId tag when I included it.
To summarize:
You don't need a pluginManagment block for org.eclipse.m2e
Add a <?m2e ignore?> tag in your <execution> tag(s) :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<?m2e ignore?>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
...{your configuration} ...
</configuration>
</execution>
</executions>
</plugin>
https://www.eclipse.org/m2e/documentation/release-notes-17.html#new-syntax-for-specifying-lifecycle-mapping-metadata

For those returning to this question, it may be useful to report seeing the same problem in Eclipse against maven-dependency-plugin version 2.8. This was in the package phase:
Artifact has not been packaged yet. When used on reactor artifact, copy should be executed after packaging: see MDEP-187. (org.apache.maven.plugins:maven-dependency-plugin:2.8:copy:copy-proguard:package)
In this case upgrading to 3.1.1 solved the problem:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy-proguard</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
...

This issue related to eclipse IDE:
Solution is to update M2E Connector for the maven-dependency-plugin
Steps :
Help ---> Eclipse Marketplace.. then update the plugin.

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>

Automatic update of generated css files via m2e

I'm using the lesscss-maven-plugin to generate different css files to the target directory (target\generated-sources) and then use maven-war-plugin to add this directory as an webResouce. Those files will generate perfectly fine.
However the m2e-plugin (version 1.0.0) won't copy those files in the according web-resources folder (m2e-wtp\web-resources), when they have changed. Only when I run a eclipse "maven/update project" changes will be updated. But I want the changes to take affect automatically, when the files have changed. Here is my pom configuration:
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions><pluginExecution>
<pluginExecutionFilter>
<groupId>org.lesscss</groupId>
<artifactId>lesscss-maven-plugin</artifactId>
<versionRange>[1.3.3]</versionRange>
<goals>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>true</runOnIncremental>
<runOnConfiguration>true</runOnConfiguration>
</execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
....
<plugin>
<groupId>org.lesscss</groupId>
<artifactId>lesscss-maven-plugin</artifactId>
<version>1.3.3</version>
<configuration>
<sourceDirectory>${project.basedir}/src/main/less</sourceDirectory>
<outputDirectory>${project.build.directory}/generated-sources/styles</outputDirectory>
<lessJs>${project.basedir}/tools/less/less-1.7.0.min.js</lessJs>
<includes>
<include>backend/backend-main.less</include>
<include>frontend/frontend-main.less</include>
</includes>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<webResources>
<resource>
<directory>${project.build.directory}/generated-sources/styles</directory>
<targetPath>styles</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
There are two options:
Use an m2e specific profile
This is similar to the workaround you found, but a bit cleaner as it activates the profile only on m2e and you use a property to set an alternative value for when you package not using m2e.
You create an m2e specific profile that, when activated, will put the files directly in the m2e-wtp/web-resources/styles directory
<properties>
<lesscss.outputDirectory>${project.build.directory}/${project.build.finalName}/styles</lesscss.outputDirectory>
</properties>
<profiles>
<profile>
<id>m2e</id>
<activation>
<property>
<name>m2e.version</name>
</property>
</activation>
<properties>
<lesscss.outputDirectory>${project.build.directory}/m2e-wtp/web-resources/styles</lesscss.outputDirectory>
</properties>
</profile>
</profiles>
<plugin>
<groupId>org.lesscss</groupId>
<artifactId>lesscss-maven-plugin</artifactId>
<version>1.3.3</version>
<configuration>
<sourceDirectory>${project.basedir}/src/main/webapp/styles</sourceDirectory>
<outputDirectory>${lesscss.outputDirectory}</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
<phase>process-sources</phase>
</execution>
</executions>
</plugin>
Source: https://github.com/marceloverdijk/lesscss-maven-plugin/issues/8
Use m2e-wro4j
It promises to:
execute wro4j-maven-plugin:run on Eclipse incremental builds, if a change is detected on css, js, less, json, sass resources under wro4j-maven-plugin's contextFolder (src/main/webapp by default)
Source: https://github.com/jbosstools/m2e-wro4j
The idea for my actual workaround was to modify the css file in target\m2e-wtp by "hand".
(First I tried to copy the css files from target\generated-sources to target\m2e-wtp with the maven-resource-plugin, but for a unkown reason, even the maven-resource-plugin was not coping when the filed css files in target\generated-sources gets updated.)
So I came up with this soution: let the lesscss-maven-plugin generate the files twice, one bunch to target\generated-sources and the second one to target\m2e-wtp. Of course the lesscss-maven-plugin has only one output folder, so one has to run the less:compile goal twice. (This is a bit slow, but it works.)
Because one need the second bunch of css files only in eclipse I have added the second execution to an profile.
<profile>
<id>less-eclipse-m2e-workarround</id>
<!--
problem: Eclipse is not updating m2e-wtp folder when css files in generated-sources get modified
workarround: generate the css twice: the normal nonce for generated-sources and a second bunch (only
for eclipse) directly into m2e-wtp folder
to enable this profile add the profile-id to: project/properties/maven/active maven profiles
details: http://stackoverflow.com/questions/23521410/automatic-update-of-generated-css-files-via-m2e
-->
<build>
<plugins>
<plugin>
<groupId>org.lesscss</groupId>
<artifactId>lesscss-maven-plugin</artifactId>
<executions>
<execution>
<id>for-eclipse</id>
<phase>generate-resources</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/m2e-wtp/web-resources/styles</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

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>

adding src/main/aspect as a source folder to an eclipse maven project

I would like to be able to configure the pom.xml so that when I import it into eclipse it specifies src/main/aspect as an eclipse source folder.
At the moment, importing creates the default source folders but that is all.
What should be done?
Thanks
edit 1
I have configured the aspectj plugin thus:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
<configuration>
<source>${project.build.source}</source>
<target>${project.build.target}</target>
<aspectDirectory>src/main/aspect</aspectDirectory>
<testAspectDirectory>src/test/aspect</testAspectDirectory>
</configuration>
</execution>
</executions>
</plugin>
edit 2
I have configured the m2e plugin thus:
<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.4,)
</versionRange>
<goals>
<goal>test-compile</goal>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
You shouldn't configure the defaults of the plugin, cause it defines already the src/test/aspect and src/main/aspect and it shouldn't be necessary to configuration something supplemental to compile etc.
Furthermore the problem with eclipse could be based on a missing mapping for your m2e plugin this means to add the following to your 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.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<versionRange>[1.4,)</versionRange>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
This might cause you problem in Eclipse not to see the source folder correctly imported.
I believe source is supposed to be a java version, not a directory. Same for target. sources allows you to specify the source directories, and the docs say that if not specified, the java sources of the current project will be used - just one for your project as configured currently.
I would try listing the directories in the sources parameter, and if that didn't work, I'd remove sources and try build-helper:add-source. I'm not sure there's an m2e connector for build-helper-maven-plugin yet so you might have to add a similar mapping to the one khmarbaise mentioned.
I think it would not be added as source folder by Eclipse. you could add it on your own in Java Build Path > Source.
This is not necessary: Then you need to have AJDT plugin installed in and convert the project to AspectJ Project, otherwise the .ajfiles will be full of errors complained by Eclipse. The errors does not affect maven compiling.
In my experience, recognized or not as source would not affect maven compiling the .aj files under src/main/aspect
Both aspectDirectory and aspectTestDirectory have default values as you given. they are not needed if the same as default.
Here below is my pom configuration (didn't try test-compile) and it works:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<!--<Xlint>ignore</Xlint>--><!--bypass xlint warnings -->
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.7.2</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>

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.