title: Error on "package does not exist" while using Maven
body: <p>I am using Maven to build a HelloWorld Program. But I failed on </p>
  
  <pre><code>mvn package
  </code></pre>
  
  <p>Error messages are:</p>
  
  <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-    plugin:3.1:compile (default-compile) on project QuickStart: Compilation failure: Compilation failure:
  [ERROR] /Users/xxx/java/QuickStart/src/main/java/hello/Greeting.java:[3,43] package org.hibernate does not exist
  [ERROR] /Users/xxx/java/QuickStart/src/main/java/hello/Greeting.java:[8,9] cannot find symbol
  [ERROR] symbol:  class Session 
  [ERROR] location: class hello.Greeting
  </code></pre>
  
  <p>And I find that if I compile Greeting.java manually, everything will work fine, what's the reason ? Thank you.</p>
  
  <p>Greeting.java is so simple:</p>
  
  <pre><code>package hello;
  
  import org.hibernate.Session;
  
  public class Greeting {
  
      public Greeting() {
          Session session;
      }
  
  }
  </code></pre>
  
  <p>and my pom.xml is copied from spring.io:</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;QuickStart&lt;/groupId&gt;
      &lt;artifactId&gt;QuickStart&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&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;5.0.7.Final&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
  
  &lt;/project&gt;
  </code></pre>