maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e
Solution 1
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:
Solution 2
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>
Solution 3
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
Solution 4
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
Solution 5
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>
Related videos on Youtube
Naftuli Kay
Updated on July 08, 2022Comments
-
Naftuli Kay almost 2 years
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?
-
matbrgz over 11 yearsThese days m2e provides a quickfix to add the appropriate configuration to your pom.xml to make m2e ignore the unsupported goal.
-
Muhammad Gelbana about 10 years@ThorbjørnRavnAndersen, what is the quick fix ?
-
matbrgz about 10 years@MuhammadGelbana In Eclipse a "quick fix" means: put the cursor on the problem; press Ctrl-1; Choose Quick Fix.
-
-
stemm about 12 yearsThanks, it also helps in Eclipse Indigo SR2
-
xverges about 12 yearsI'm a bit lost... Does that mean using the code above but with
<execute />
instead of<ignore />
? Thanks! -
bartv almost 12 yearsWhat if copy-dependencies is a vital step in building your WAR file? I am working with monstrosity the call m2Eclipse and even if changing the action to execute, the vital files are not copied to the target folder...
-
Arjan almost 12 yearsCare to explain a bit more? Just putting a
<plugin>
into<pluginManagement>
but still referencing it to do its job, still gives me the same warning. -
Arjan almost 12 yearsFor auto-generated ignore settings, @PhoneTech, m2e adds the comment "This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself." Not sure what that means though, as you're saying things don't get copied for you.
-
Arjan almost 12 years@CaioToOn, maybe you know some more...? After adding it to
<pluginManagement>
I still need to add a "regular" 2 line<build><plugins><plugin>...
as well, referencing the one as configured in<pluginManagement>
, right? (Still seeing Juno complain about the same thing, when in<pluginManagement>
.) -
Caio Cunha almost 12 years@Arjan you should enclose your
plugins
tag withpluginManagement
. But take a look at the answer I gave below, stackoverflow.com/a/12109018/179138 . The suggested one ignores the execution, but don't execute the plugin on Eclipse. -
Arjan almost 12 yearsThis solves it indeed. And I was being stupid, thinking when people were talking about moving
<plugins>
into<pluginManagement>
one should actually move the<groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId>
in there. But it's about the<groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId>
that needs to be enclosed in<pluginManagement>
. When using Quick Fix in Eclipse, the same is added above the regular<plugins>
, and it seems that location works fine too. Key is then to change<ignore>
into<execute>
. Nice. -
cyber-monk over 11 yearsFound I needed <runOnIncremental>false</runOnIncremental> within execute as recommended on the link you provided. Thanks for the answer set me on the right path.
-
dokaspar over 11 yearsYes, it helped... but that's an awful lot of code to just get rid of a warning :P
-
Olivier B. about 11 yearsYes, this is exactly the purpose of this entry : m2e now requires connectors to map plugins executions in Eclipse build lifecycle. <br/> Even at the time of my comment writing, m2e only supports a few such connectors : you have to use the
lifecycle-mapping
Maven plugin to instruct m2e how to deal with an unsupported plugin (here themaven-dependency-plugin
) -
Fagner Brack about 10 yearsThere is no need to add this AFTER your
plugins
inside thebuild
, you can add this before. -
stevecross about 10 yearsThis still gives me a warning, but the error is gone.
-
Fagner Brack about 9 years+1 for the RIGHT answer. Just remember make a small edit to the
pom.xml
file after installing the plugin, otherwise the error might not go away. -
jansohn about 9 yearsIn Eclipse Luna the Catalog URL is download.eclipse.org/technology/m2e/discovery/directory-1.5.xml
-
Jess almost 9 yearsCan you please provide with the goal to execute in eclipse ?
-
mmo almost 8 yearsI tried this but the Catalog URL fields is not editable! Mine is set to : download.eclipse.org/technology/m2e/discovery/directory.xml (i.e. without the -1.4) at the end. Any ideas, how/where one could adjust that?