title: How can I use classes from other project with maven? (ClassNotFoundException and NoClassDefFoundError is thrown)
body: <p>I have two Vaadin projects (I will name them A and B). Both are using Maven for resolving the dependencies and are in the same workspace. I'm working with Eclipse and I'm using the m2e-plugin. I want to use some classes of B in project A. In Eclipse I can instatiate them without errors/warnings but when I try to run A I get a <code>ClassNotFoundException</code> and a <code>NoClassDefFoundError</code> caused by instatiating a class of B.</p>
  
  <p>The <code>.class</code> files of A are located in <code>...\workspace\A\target\classes</code> and the for project B they are in <code>...\workspace\B\target\classes</code>. 
  I've been trying to solve this problem but I didn't find a solution.
  What I tried so far:</p>
  
  <ul>
  <li>Configure build path -> Libaries -> add Class Folder -> B\target</li>
  <li>Configure build path -> Libaries -> add External Class Folder -> B\target</li>
  <li>Configure build path -> Projects -> add -> B</li>
  </ul>
  
  <p>I think adding the project is necessary because when I remove it, Eclipse gives me error messages when I try to use the classes from B in A</p>
  
  <p>I don't have any idea what else to do. Maybe I have to configure my <code>pom.xml</code> file but I don't know what I must do there.</p>
  
  <p>Edit:
  In pom.xml of project B:</p>
  
  <pre><code>&lt;groupId&gt;de.qufis&lt;/groupId&gt;
  &lt;artifactId&gt;CentwertApp&lt;/artifactId&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;CentwertApp&lt;/name&gt;
  </code></pre>
  
  <p>In pom.xml of project A:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;de.qufis&lt;/groupId&gt;
          &lt;artifactId&gt;CentwertApp&lt;/artifactId&gt;
          &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
          &lt;type&gt;war&lt;/type&gt;
          &lt;scope&gt;import&lt;/scope&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>I did clean compile for project B with maven build.
  Then I tried to do the same with project A but then I get error message:
  Could not find artifact de.qufis:CentwertApp:war:0.0.1-SNAPSHOT in vaadin-addons (<a href="http://maven.vaadin.com/vaadin-addons" rel="noreferrer">http://maven.vaadin.com/vaadin-addons</a>)</p>
  
  <p>When I run the Application normally I still get the ClassNotFoundException and NoClassDefError.</p>
  
  <p>Edit 2:
  I have added </p>
  
  <pre><code>&lt;scope&gt;compile&lt;/scope&gt;
  </code></pre>
  
  <p>When I run Maven build (clean compile), part of my building process looks like this:</p>
  
  <p>[INFO] Building centwertAdmin 0.0.1-SNAPSHOT</p>
  
  <p>[INFO] ------------------------------------------------------------------------</p>
  
  <p>[WARNING] The POM for de.qufis:CentwertApp:war:0.0.1-SNAPSHOT is missing, no dependency information available</p>
  
  <p>[INFO] ------------------------------------------------------------------------</p>
  
  <p>[INFO] BUILD FAILURE</p>
  
  <p>Then there is the errormessage:</p>
  
  <p>[ERROR] Failed to execute goal on project centwertAdmin: Could not resolve dependencies for project de.qufis:centwertAdmin:war:0.0.1-SNAPSHOT: Failure to find de.qufis:CentwertApp:war:0.0.1-SNAPSHOT in <a href="http://maven.vaadin.com/vaadin-addons" rel="noreferrer">http://maven.vaadin.com/vaadin-addons</a> was cached in the local repository, resolution will not be reattempted until the update interval of vaadin-addons has elapsed or updates are forced -> [Help 1]</p>