title: Run main from test scope in Maven: "The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java are missing or invalid"
body: <p>I want to execute a main class that sits in the test src folder.
  I tried:</p>
  
  <pre><code>mvn -q exec:java \
      -Dexec.mainClass=com.example.beanoverriding.EmbeddedApplication \
      -Dexec.classpathScope="test"
  </code></pre>
  
  <p>But get:</p>
  
  <pre><code>[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project bean-overriding: 
          The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java are missing or invalid -&gt; [Help 1]
  </code></pre>
  
  <p>See the code in action:</p>
  
  <p><a href="https://gitpod.io#snapshot/9fe61382-a802-4b0f-9ae1-844a3987fe26" rel="nofollow noreferrer"><img src="https://gitpod.io/button/open-in-gitpod.svg" alt="Open in Gitpod"></a></p>
  
  <p><strong>Edit:</strong> 
  Writing it like this works:</p>
  
  <pre><code>mvn -q exec:exec \
      -Dexec.executable=java \
      -Dexec.args="-cp %classpath com.example.beanoverriding.EmbeddedApplication" \
      -Dexec.classpathScope="test"
  </code></pre>