title: Maven exec plugin main class missing
body: <p>I'm trying to go through Hibernate tutorial and got stuck on running the command</p>
  
  <pre><code>C:\Users\Eyal\workspace\FirstHibernateTutorial&gt;mvn exec:java -Dexec.mainclass="o
  rg.hsqldb.Server" -Dexec.args="-database.O file:target/data/tutorial" -e
  </code></pre>
  
  <p>and get these errors.</p>
  
  <pre><code>[INFO] Error stacktraces are turned on.
  [INFO] Scanning for projects...
  [WARNING]
  [WARNING] Some problems were encountered while building the effective model for
  org.hibernate.tutorials:hibernate-tutorial:jar:1.0.0-SNAPSHOT
  [WARNING] The expression ${artifactId} is deprecated. Please use ${project.artif
  actId} instead.
  [WARNING]
  [WARNING] It is highly recommended to fix these problems because they threaten t
  he stability of your build.
  [WARNING]
  [WARNING] For this reason, future Maven versions might no longer support buildin
  g such malformed projects.
  [WARNING]
  [INFO]
  [INFO] ------------------------------------------------------------------------
  [INFO] Building First Hibernate Tutorial 1.0.0-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO]
  [INFO] &gt;&gt;&gt; exec-maven-plugin:1.2:java (default-cli) @ hibernate-tutorial &gt;&gt;&gt;
  [INFO]
  [INFO] &lt;&lt;&lt; exec-maven-plugin:1.2:java (default-cli) @ hibernate-tutorial &lt;&lt;&lt;
  [INFO]
  [INFO] --- exec-maven-plugin:1.2:java (default-cli) @ hibernate-tutorial ---
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 1.964s
  [INFO] Finished at: Thu Apr 21 18:31:10 IDT 2011
  [INFO] Final Memory: 4M/15M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:java (def
  ault-cli) on project hibernate-tutorial: The parameters 'mainClass' for goal org
  .codehaus.mojo:exec-maven-plugin:1.2:java are missing or invalid -&gt; [Help 1]
  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
  rg.codehaus.mojo:exec-maven-plugin:1.2:java (default-cli) on project hibernate-t
  utorial: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin
  :1.2:java are missing or invalid
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:221)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:153)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:145)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
  ct(LifecycleModuleBuilder.java:84)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
  ct(LifecycleModuleBuilder.java:59)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
  ild(LifecycleStarter.java:183)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
  eStarter.java:161)
          at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
          at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
          at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
          at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
          at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
  java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
  sorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
  cher.java:290)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
  a:230)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
  uncher.java:409)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
  352)
  Caused by: org.apache.maven.plugin.PluginParameterException: The parameters 'mai
  nClass' for goal org.codehaus.mojo:exec-maven-plugin:1.2:java are missing or inv
  alid
          at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePl
  uginFields(DefaultMavenPluginManager.java:576)
          at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfigu
  redMojo(DefaultMavenPluginManager.java:529)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
  BuildPluginManager.java:92)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:209)
          ... 19 more
  [ERROR]
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR]
  [ERROR] For more information about the errors and possible solutions, please rea
  d the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParamete
  rException
  </code></pre>
  
  <p>I did changed one thing in the pom file. I added the versions of the dependencies. this is the pom.xml. I changed it because without it, I'm getting errors about lack of version specification.</p>
  
  <pre><code>    &lt;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"&gt;
  
  
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;org.hibernate.tutorials&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-tutorial&lt;/artifactId&gt;
      &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;First Hibernate Tutorial&lt;/name&gt;
  
      &lt;build&gt;
          &lt;!-- we dont want the version to be part of the generated war file name --&gt;
          &lt;finalName&gt;${artifactId}&lt;/finalName&gt;
      &lt;/build&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;3.3.1.GA&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Because this is a web app, we also have a dependency on the servlet api. --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
              &lt;version&gt;[2.4,)&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Hibernate uses slf4j for logging, for our purposes here use the simple backend --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-simple&lt;/artifactId&gt;
              &lt;version&gt;1.5.6&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Hibernate gives you a choice of bytecode providers between cglib and javassist --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javassist&lt;/groupId&gt;
              &lt;artifactId&gt;javassist&lt;/artifactId&gt;
              &lt;version&gt;[3.0,)&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I think the <strong>main problem</strong> is in the line</p>
  
  <p><code>The parameters 'mainClass' for goal org
  .codehaus.mojo:exec-maven-plugin:1.2:java are missing or invalid -&gt; [Help 1]</code></p>
  
  <p>Why does mainClass is not valid?
  Can you see something I don't?</p>
  
  <p>EDIT:</p>
  
  <p>OK, I changed "mainclass" to "mainClass" and it gives me this error about not finding "org.hsqldb.Server". I added hsqldb.jar to Eclipse' reference libraries but still it gives me the same error. </p>
  
  <p>This is the stack print:</p>
  
  <pre><code>C:\Users\Eyal\workspace\FirstHibernateTutorial&gt;mvn exec:java -Dexec.mainClass="o
  rg.hsqldb.Server" -Dexec.args="-database.O file:target/data/tutorial" -e
  [INFO] Error stacktraces are turned on.
  [INFO] Scanning for projects...
  [WARNING]
  [WARNING] Some problems were encountered while building the effective model for
  org.hibernate.tutorials:hibernate-tutorial:jar:1.0.0-SNAPSHOT
  [WARNING] The expression ${artifactId} is deprecated. Please use ${project.artif
  actId} instead.
  [WARNING]
  [WARNING] It is highly recommended to fix these problems because they threaten t
  he stability of your build.
  [WARNING]
  [WARNING] For this reason, future Maven versions might no longer support buildin
  g such malformed projects.
  [WARNING]
  [INFO]
  [INFO] ------------------------------------------------------------------------
  [INFO] Building First Hibernate Tutorial 1.0.0-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO]
  [INFO] &gt;&gt;&gt; exec-maven-plugin:1.2:java (default-cli) @ hibernate-tutorial &gt;&gt;&gt;
  [INFO]
  [INFO] &lt;&lt;&lt; exec-maven-plugin:1.2:java (default-cli) @ hibernate-tutorial &lt;&lt;&lt;
  [INFO]
  [INFO] --- exec-maven-plugin:1.2:java (default-cli) @ hibernate-tutorial ---
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 1.106s
  [INFO] Finished at: Sat Apr 23 10:46:09 IDT 2011
  [INFO] Final Memory: 4M/15M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:java (def
  ault-cli) on project hibernate-tutorial: An exception occured while executing th
  e Java class. org.hsqldb.Server -&gt; [Help 1]
  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
  rg.codehaus.mojo:exec-maven-plugin:1.2:java (default-cli) on project hibernate-t
  utorial: An exception occured while executing the Java class. org.hsqldb.Server
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:217)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:153)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:145)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
  ct(LifecycleModuleBuilder.java:84)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
  ct(LifecycleModuleBuilder.java:59)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
  ild(LifecycleStarter.java:183)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
  eStarter.java:161)
          at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
          at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
          at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
          at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
          at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
  java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
  sorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
  cher.java:290)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
  a:230)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
  uncher.java:409)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
  352)
  Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured
  while executing the Java class. org.hsqldb.Server
          at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:346)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
  BuildPluginManager.java:101)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:209)
          ... 19 more
  Caused by: java.lang.ClassNotFoundException: org.hsqldb.Server
          at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
          at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:284)
          at java.lang.Thread.run(Thread.java:662)
  [ERROR]
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR]
  [ERROR] For more information about the errors and possible solutions, please rea
  d the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
  xception
  C:\Users\Eyal\workspace\FirstHibernateTutorial&gt;
  </code></pre>