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

EclipseMavenM2eclipse

Eclipse Problem Overview


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?

Eclipse Solutions


Solution 1 - Eclipse

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:

Eclipse Settings

Solution 2 - Eclipse

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 - Eclipse

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 - Eclipse

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:

  1. go to Window/Preferences/Maven/Discovery/
  2. enter Catalog URL: http://download.eclipse.org/technology/m2e/discovery/directory-1.4.xml
  3. click Open Catalog
  4. choose the m2e-maven-dependency-plugin
  5. enjoy

Solution 5 - Eclipse

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>

Solution 6 - Eclipse

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.

Solution 7 - Eclipse

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.

Solution 8 - Eclipse

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNaftuli KayView Question on Stackoverflow
Solution 1 - EclipsemaksimovView Answer on Stackoverflow
Solution 2 - EclipseCaio CunhaView Answer on Stackoverflow
Solution 3 - Eclipseuser311174View Answer on Stackoverflow
Solution 4 - EclipsemarioView Answer on Stackoverflow
Solution 5 - EclipseSGBView Answer on Stackoverflow
Solution 6 - EclipseMylucoView Answer on Stackoverflow
Solution 7 - EclipseAndnaView Answer on Stackoverflow
Solution 8 - Eclipseblue-skyView Answer on Stackoverflow