m2e 不支持 maven-dependency-plugin(目标“copy-dependencies"、“unpack") [英] maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e
问题描述
我有一个相当简单的 Maven 项目:
<依赖项>...</依赖项><构建><插件><插件><groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId><version>2.4</version><执行><执行><id>复制依赖</id><phase>包</phase><目标><目标>复制依赖</目标></目标><配置><outputDirectory>${project.build.directory}/dependencies</outputDirectory></配置></执行></执行></插件></插件></build></项目>
但是,我在 m2eclipse 中得到以下错误:
描述资源路径位置类型m2e 不支持 maven-dependency-plugin(目标copy-dependencies"、unpack").pom.xml/jasperreports-test line 60 Maven 项目构建生命周期映射问题
为什么我在意 m2eclipse 不支持"这个任务?Maven 做到了,这就是我真正关心的.我怎样才能让我的项目中的这个错误消失?
这似乎是一个已知问题.您可以指示 m2e 忽略这一点.
选项 1:pom.xml
在您的 <build/>
标签中添加以下内容:
<插件><!-- 忽略/执行插件执行--><插件><groupId>org.eclipse.m2e</groupId><artifactId>生命周期映射</artifactId><version>1.0.0</version><配置><lifecycleMappingMetadata><插件执行><!-- 复制依赖插件--><插件执行><pluginExecutionFilter><groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId><versionRange>[1.0.0,)</versionRange><目标><目标>复制依赖</目标></目标></pluginExecutionFilter><动作><忽略/></动作></pluginExecution></pluginExecutions></lifecycleMappingMetadata></配置></插件></plugins></pluginManagement>
您将需要在此之后对您的项目执行 Maven... -> 更新项目配置.
阅读更多:http://wiki.eclipse.org/M2E_plugin_execution_not_covered#m2e_maven_plugin_coverage_status
选项 2:全局 Eclipse 覆盖
为避免更改 POM 文件,可以通过 Eclipse 设置将忽略覆盖应用于整个工作区.
将此文件保存在磁盘上的某个位置:https://gist.github.com/maksimov/8906462>
在 Eclipse/Preferences/Maven/Lifecycle Mappings
中浏览到此文件并单击 OK:
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:
这篇关于m2e 不支持 maven-dependency-plugin(目标“copy-dependencies"、“unpack")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!