我有一个相当简单的 Maven 项目:
<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>
但是,我在 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
为什么我关心 m2eclipse 是否不“支持”这个任务? Maven 做到了,这就是我真正关心的。我怎样才能让我的项目中的这个错误消失?
这似乎是一个已知问题。您可以指示 m2e 忽略它。
选项 1:pom.xml
将以下内容添加到您的<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>
此后,您将需要在项目上执行 Maven... -> 更新项目配置。
阅读更多:http://wiki.eclipse.org/M2E_plugin_execution_not_covered#m2e_maven_plugin_coverage_status http://wiki.eclipse.org/M2E_plugin_execution_not_covered#m2e_maven_plugin_coverage_status
选项 2:全局 Eclipse 覆盖
为了避免更改 POM 文件,可以通过 Eclipse 设置将忽略覆盖应用于整个工作区。
将此文件保存在磁盘上的某个位置:https://gist.github.com/maksimov/8906462 https://gist.github.com/maksimov/8906462
In Eclipse/Preferences/Maven/Lifecycle Mappings
浏览到该文件并单击“确定”:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)