How do I execute a program using Maven?

Posted by Will on Stack Overflow See other posts from Stack Overflow or by Will
Published on 2010-03-18T18:23:26Z Indexed on 2010/03/18 19:31 UTC
Read the original article Hit count: 152

Filed under:
|

I would like to have a Maven goal trigger the execution of a java class. I'm trying to migrate over a Makefile with the lines:

neotest:
    mvn exec:java -Dexec.mainClass="org.dhappy.test.NeoTraverse"

And I would like mvn neotest to produce what make neotest does currently.

Neither the exec plugin documentation nor the Maven Ant tasks pages had any sort of straightforward example.

Currently, I'm at:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.1</version>
  <executions><execution>
    <goals><goal>java</goal></goals>
  </execution></executions>
  <configuration>
    <mainClass>org.dhappy.test.NeoTraverse</mainClass>
  </configuration>
</plugin>

I don't know how to trigger the plugin from the command line, though.

© Stack Overflow or respective owner

Related posts about maven-2

Related posts about maven-plugin