5

我在我的 中收到此错误,我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>

尝试从 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]

我真的很感激任何帮助!

4

3 回答 3

7

这对我有用

要解决此错误,您需要做的就是在构建结束标记之前复制以下代码。

       <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>
于 2013-08-22T17:01:15.413 回答
5

我和你有同样的问题

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

运行方式 -> Maven 构建

然后在Goals中输入compile

于 2012-05-02T04:38:58.037 回答
3

从上面的错误消息来看,您似乎已经尝试过,Run as -> Maven Build但没有指定要运行哪个 Maven goal

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

现在,至于警告,copy-dependencies is not supported by m2e表示m2e不支持这个插件。m2e 目前并不支持所有的 Maven 功能。

于 2011-11-26T17:51:10.730 回答