eclipse m2e:m2e 不支持复制依赖

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8271106/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:43:55  来源:igfitidea点击:

m2e: copy-dependencies is not supported by m2e

eclipsemavenm2e

提问by Oskar Ferm

I get this error in my pom.xml, and I can't understand what I need to change in order to get eclipse to run the project (run as -> maven build)

我在我的 .py 中收到此错误,我pom.xml无法理解我需要更改什么才能让 eclipse 运行该项目(运行方式 -> maven build)

<build>
    <plugins>
        <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>com.cc.adapter.mock.InsertAccountStarter</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
       <!-- Line below is the error -->
                <execution>
                    <phase>install</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.build.directory}/lib</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-codegen-plugin</artifactId>
            <version>${cxf.version}</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.cxf</groupId>
                    <artifactId>cxf-rt-bindings-soap</artifactId>
                    <version>${cxf.version}</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>generate-sources</id>
                    <configuration>
                        <sourceRoot>src/main/generated</sourceRoot>

                        <wsdlOptions>
                            <wsdlOption>
                                <wsdl>src/main/wsdl/CrmService.wsdl</wsdl>
                                <autoNameResolution>true</autoNameResolution>
                                <extendedSoapHeaders>true</extendedSoapHeaders>
                            </wsdlOption>
                        </wsdlOptions>
                    </configuration>
                    <goals>
                        <goal>wsdl2java</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

The error when trying to build it from within eclipse is

尝试从 eclipse 中构建它时的错误是

[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy, pre-clean, clean, post-clean. -> [Help 1]

I would really appreciate any help!

我真的很感激任何帮助!

采纳答案by Raghuram

From the error message above, it appears that you have tried the Run as -> Maven Buildwithout specifying which maven goalto run.

从上面的错误消息来看,您似乎在Run as -> Maven Build没有指定goal要运行的maven的情况下尝试了。

You should try a specific maven goal - Run as -> Maven installor Run as -> Maven test. Alternately, you can provide a goal in the Maven Build configuration.

您应该尝试特定的 Maven 目标 -Run as -> Maven installRun as -> Maven test. 或者,您可以在Maven Build configuration.

Now, as for the warning, copy-dependencies is not supported by m2e, it means that m2e does not support this plugin. Not all the maven functionality are currently supported by m2e.

现在,至于警告,copy-dependencies is not supported by m2e表示 m2e 不支持此插件。m2e 当前并非支持所有 maven 功能。

回答by Kieveli

This worked for me:

这对我有用

To resolve this error all you need to do is copy following code just before your closing tag of build.

要解决此错误,您只需在 build 的结束标记之前复制以下代码。

       <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <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>unpack</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

回答by ardhiesta

I have the same problem as yours

我和你有同样的问题

When you want to compile your Maven project using m2eclipse plugin, try

当您想使用 m2eclipse 插件编译您的 Maven 项目时,请尝试

Run as -> Maven Build

运行方式 -> Maven 构建

then type compilein Goals

然后在目标中输入编译