maven依赖插件(目标“拷贝依赖”,“拆包”)不受m2e支持 [英] maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e

查看:151
本文介绍了maven依赖插件(目标“拷贝依赖”,“拆包”)不受m2e支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相当简单的Maven项目:

 < project> 
<依赖关系>
...
< / dependencies>

< build>
< plugins>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-dependency-plugin< / artifactId>
< version> 2.4< / version>
<执行>
< 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中收到以下错误:

 描述资源路径位置类型
maven-dependency-plugin(目标拷贝依赖,unpack)不受m2e支持。 pom.xml / jasperreports-test line 60 Maven项目构建生命周期映射问题

为什么我关心m2eclipse不支持这个任务吗? Maven做,这就是我真正关心的。如何在我的项目中得到这个错误呢?

解决方案

这似乎是一个已知的问题。你可以指示m2e忽略这个。



选项1:pom.xml



< build /> 标签:

 < pluginManagement> 
< plugins>
<! - 忽略/执行插件执行 - >
< plugin>
< groupId> org.eclipse.m2e< / groupId>
< artifactId>生命周期映射< / artifactId>
< version> 1.0.0< / version>
< configuration>
< lifecycleMappingMetadata>
< pluginExecutions>
<! - 拷贝依赖插件 - >
< 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 ... - >更新项目配置。 / p>

阅读更多内容: 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 浏览到此文件,然后单击确定:




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:

这篇关于maven依赖插件(目标“拷贝依赖”,“拆包”)不受m2e支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆