Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to execute goal org.codehous.mojo:exec-maven-plugin:1.4.0:java

Tags:

java

maven

I've been trying to run this Maven program all day but to no avail. I keep getting this error:

[ERROR] Failed to execute goal org.codehous.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project get-with-jersey: The parameters ‘mainClass’ for goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java are missing or invalid

After running mvn exec:java.

mvn clean install works fine and builds, but running the program fails.

I downloaded and placed the plugin for 1.4.0 where I believe Maven lets all it's plugins exist, but I can't figure out why it keeps crashing.

Here is my 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.bridge.rest.jersey</groupId>
<artifactId>get-with-jersey</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Get Request with Jersey</name>

<repositories>
    <repository>
        <id>maven2-repository.java.net</id>
        <name>Java.net Repository for Maven</name>
        <url>http://download.java.net/maven/2/</url>
        <layout>default</layout>
    </repository>
</repositories>

<dependencies>

    <!--
    <dependency>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.2.1</version>
    </dependency>
    -->

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.9</version>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-client</artifactId>
        <version>1.9</version>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-json</artifactId>
        <version>1.9</version>
    </dependency>

    <dependency> 
        <groupId>org.hsqldb</groupId> 
        <artifactId>hsqldb</artifactId> 
        <version>2.0.0</version> 
    </dependency>

</dependencies>

Thanks for your help, looking forward to your answers!

like image 753
xtheking Avatar asked Aug 11 '15 20:08

xtheking


1 Answers

You have not specified the main class to run:

mvn exec:java -Dexec.mainClass=foo.bar.MainClass

http://www.mojohaus.org/exec-maven-plugin/java-mojo.html

like image 87
M A Avatar answered Nov 15 '22 14:11

M A