title: Maven compilation fails with "cannot find symbol" while with Eclipse, it compiles
body: <p>I have a compilation error in Maven but in Eclipse everything goes well.</p>
  
  <p>Is there something I am doing wrong or is it a Maven bug?</p>
  
  <p>I have created a code snippet, so you can try to reproduce it.</p>
  
  <p>Here are the Java source files and a pom.xml.</p>
  
  <pre><code>package p1;
  
  import p1.A.D.C;
  import p1.p2.E;
  
  public class A {
      interface B&lt;T&gt; {
          T methodB();
      }
  
      class D implements B&lt;E&gt; {
          C c = new C();
  
          public C getC() {
              return c;
          }
  
          class C {
              public void methodC() {
                  System.out.println(this);
              }
          }
  
          @Override
          public E methodB() {
              return new E();
          }
      }
  
      public void methodA() {
          D d = new D();
          d.methodB();
          C c = d.getC();
          c.methodC();
      }
  
      public static void main(String[] args) {
          A a = new A();
          a.methodA();
      }
  }
  </code></pre>
  
  <p><br /></p>
  
  <pre><code>package p1.p2;
  
  public class E {
  }
  </code></pre>
  
  <p><br /></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;mvntst&lt;/groupId&gt;
    &lt;artifactId&gt;test&lt;/artifactId&gt;
    &lt;version&gt;0&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
    &lt;name&gt;mvntst&lt;/name&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>When I run <code>mvn clean compile</code>, I get this output:</p>
  
  <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project test: Compilation failure
  [ERROR] /C:/dev/test/CompilerTest/MavenTest/src/main/java/p1/A.java:[6,30] cannot find symbol
  [ERROR] symbol:   class E                                                                                                                       
  [ERROR] location: class p1.A
  [ERROR] -&gt; [Help 1]                                                                                                                             
  [ERROR]
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.                                                             
  [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 read the following articles:                                       
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
  </code></pre>
  
  <p>Here is the result of <code>mvn --version</code>:</p>
  
  <pre><code>Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 2015-03-13T23:10:27+03:00)
  Maven home: C:\dev\apache-maven-3.3.1\bin\..
  Java version: 1.8.0_40, vendor: Oracle Corporation
  Java home: C:\Program Files\Java\jdk1.8.0_40\jre
  Default locale: en_US, platform encoding: Cp1252
  OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
  </code></pre>