![](/img/trans.png)
[英]Maven error: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
[英]Why am I running into org.codehaus.mojo:exec-maven-plugin:1.2.1:exec error?
我有以下簡單的 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>
看來您正在嘗試使用Jersey 1.x建立一個新澤西項目。 我的第一個建議是使用最新的2.5.1。 另外,您肯定希望能夠從命令行運行Maven,因此請首先安裝它。 有了這些信息后,基本上,請按照以下說明設置新澤西州項目:
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
如果您有任何錯誤,可以回到這里與我們分享。
如果您嘗試創建新的 model 表,並且在出現此錯誤時錯誤地添加了兩個 @id 列標記,請檢查 model class 並刪除不必要的一個,問題將消失。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.