title: How do I execute a program using Maven?
body: <p>I would like to have a Maven goal trigger the execution of a java class. I'm trying to migrate over a <code>Makefile</code> with the lines:</p>
  
  <pre><code>neotest:
      mvn exec:java -Dexec.mainClass="org.dhappy.test.NeoTraverse"
  </code></pre>
  
  <p>And I would like <code>mvn neotest</code> to produce what <code>make neotest</code> does currently.</p>
  
  <p>Neither the <a href="http://mojo.codehaus.org/exec-maven-plugin/usage.html" rel="noreferrer">exec plugin documentation</a> nor the <a href="http://maven.apache.org/ant-tasks/" rel="noreferrer">Maven Ant tasks</a> pages had any sort of straightforward example.</p>
  
  <p>Currently, I'm at:</p>
  
  <pre><code>&lt;plugin&gt;
    &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
    &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
    &lt;version&gt;1.1&lt;/version&gt;
    &lt;executions&gt;&lt;execution&gt;
      &lt;goals&gt;&lt;goal&gt;java&lt;/goal&gt;&lt;/goals&gt;
    &lt;/execution&gt;&lt;/executions&gt;
    &lt;configuration&gt;
      &lt;mainClass&gt;org.dhappy.test.NeoTraverse&lt;/mainClass&gt;
    &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>I don't know how to trigger the plugin from the command line, though.</p>