title: Maven Jar Builder: Could not find or load main class
body: <p>I have been trying for several days now to create an executable jar file for my muli-module maven project. However, when I try to run this jar file I get "Could not find or load main class src.main.java.com.domain.Mainclass" (I have changed the name domain and MainClass for my company's privacy sake)</p>
  
  <p>I have searched for days and none of the obvious tips seem to work.</p>
  
  <p>My project has a main maven project that downloads all of the dependencies (packaging:POM)
  and several module projects (Packaging:Jar).</p>
  
  <p>Everything seems to work fine, and all of the files are compiled into class files, but somehow the main class is not being added to the pom.</p>
  
  <p>My Pom File Plugin:</p>
  
  <pre><code> &lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.2-beta-4&lt;/version&gt;
      &lt;configuration&gt;
        &lt;descriptorRefs&gt;
          &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
        &lt;/descriptorRefs&gt;
        &lt;archive&gt;
          &lt;manifest&gt;
            &lt;mainClass&gt;com.domain.project.MainClass&lt;/mainClass&gt;
          &lt;/manifest&gt;
        &lt;/archive&gt;
        &lt;/configuration&gt;
        &lt;executions&gt;
        &lt;execution&gt;
          &lt;phase&gt;package&lt;/phase&gt;
          &lt;goals&gt;
            &lt;goal&gt;single&lt;/goal&gt;
          &lt;/goals&gt;
        &lt;/execution&gt;
        &lt;/executions&gt;
        &lt;/plugin&gt;
  </code></pre>
  
  <p>The Commands I Use: mvn clean package, then I cd into the target folder and do: java -jar jarfilename.jar</p>
  
  <p>Any tips or help would be most welcomed! </p>
  
  <p>Edit:</p>
  
  <p>My current configuration creates a 2 jar files for every module:</p>
  
  <ul>
  <li>projectname-jar-with-dependencies.jar</li>
  <li>projectname.jar</li>
  </ul>
  
  <p>When I navigate to the target folder of the module with my main class, I can successfully run the jar file. However, when I try to run the jar file of my parent maven project (the one with packageing:pom) I still get the same error. Does anyone know why the main jar file cannot find the main class?</p>
  
  <p>Thanks! </p>