为什么我要运行org.codehaus.mojo:exec-maven-plugin:1.2.1:exec错误?

时间:2014-02-01 00:49:37

标签: java maven jersey

我有以下简单的pom.xml。当我运行应用程序时遇到以下错误,我为这个问题读了很多答案,但是没有用完。

    ClientConfig config = new DefaultClientConfig();
    Client client = Client.create(config);
    WebResource resource = client.resource("Query Request Goes Here");
    List<Output> allOutputs = resource.get(new GenericType<List<Output>>(){});
    System.out.println(allOutputs.size());



Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project eBaytest: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

POM.XML

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mycompany</groupId>
    <artifactId>Test</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>eBaytest</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
            <version>1.18</version>
            <type>jar</type>
        </dependency>
    </dependencies>
</project>

1 个答案:

答案 0 :(得分:4)

看起来你正在尝试使用Jersey 1.x设置一个新的Jersey项目。我的第一个建议是使用最新的2.5.1。此外,您肯定希望能够从命令行运行Maven,因此请先安装它。如果有,请按照these instructions设置一个新的Jersey项目,基本上是:

mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-grizzly2 \
-DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false \
-DgroupId=com.example -DartifactId=simple-service -Dpackage=com.example \
-DarchetypeVersion=2.5.1

之后,进行更改并运行:

mvn -e compile exec:java

如果您收到任何错误,可以回到这里与我们分享。