title: Why maven compilation failure?
body: <p>I am  trying build a java project with maven. I check maven command through <code>mvn -v</code> and it gives following output</p>
  
  <pre><code>Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T18:41:47+02:00)
  Maven home: C:\Program Files\Apache\Maven\apache-maven-3.3.9\bin\..
  Java version: 1.8.0_101, vendor: Oracle Corporation
  Java home: C:\Program Files\Java\jdk1.8.0_101\jre
  Default locale: en_US, platform encoding: Cp1252
  OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"
  </code></pre>
  
  <p>I add <code>org.joda.time.LocalTime</code> to <code>HelloWorld.java</code> as follows</p>
  
  <pre><code>package hello;
  
  import org.joda.time.LocalTime;
  
  public class HelloWorld {
      public static void main(String[] args) {
          LocalTime currentTime = new LocalTime();
          System.out.println("The current local time is: " + currentTime);
          Greeter greeter = new Greeter();
          System.out.println(greeter.sayHello());
      }
  }
  </code></pre>
  
  <p>Therefore I add <code>joda-time</code> dependency to my <code>pom.xml</code>. Here is my <code>pom.xml</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;gs-maven&lt;/artifactId&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
      &lt;version&gt;0.1.0&lt;/version&gt;
  
      &lt;dependencies&gt;
          &lt;!-- tag::joda[] --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;joda-time&lt;/groupId&gt;
              &lt;artifactId&gt;joda-time&lt;/artifactId&gt;
              &lt;version&gt;2.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- end::joda[] --&gt;
          &lt;!-- tag::junit[] --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.12&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;!-- end::junit[] --&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.1&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;shade&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;transformers&gt;
                                  &lt;transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"&gt;
                                      &lt;mainClass&gt;hello.HelloWorld&lt;/mainClass&gt;
                                  &lt;/transformer&gt;
                              &lt;/transformers&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Whenever I am going to run the <code>mvn compile</code> it gives the output as</p>
  
  <pre><code>[INFO] Scanning for projects...
  [INFO]
  [INFO] ------------------------------------------------------------------------
  [INFO] Building gs-maven 0.1.0
  [INFO] ------------------------------------------------------------------------
  [INFO]
  [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ gs-maven ---
  [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
  [INFO] skip non existing resourceDirectory H:\Projects\JAVA\web\unzipped\gs-maven\initial\src\main\resources
  [INFO]
  [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ gs-maven ---
  [INFO] Changes detected - recompiling the module!
  [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
  [INFO] Compiling 2 source files to H:\Projects\JAVA\web\unzipped\gs-maven\initial\target\classes
  [INFO] -------------------------------------------------------------
  [ERROR] COMPILATION ERROR :
  [INFO] -------------------------------------------------------------
  [ERROR] /H:/Projects/JAVA/web/unzipped/gs-maven/initial/src/main/java/hello/HelloWorld.java:[3,21] package org.joda.time does not exist
  [ERROR] /H:/Projects/JAVA/web/unzipped/gs-maven/initial/src/main/java/hello/HelloWorld.java:[7,9] cannot find symbol
    symbol:   class LocalTime
    location: class hello.HelloWorld
  [ERROR] /H:/Projects/JAVA/web/unzipped/gs-maven/initial/src/main/java/hello/HelloWorld.java:[7,37] cannot find symbol
    symbol:   class LocalTime
    location: class hello.HelloWorld
  [INFO] 3 errors
  [INFO] -------------------------------------------------------------
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 2.647 s
  [INFO] Finished at: 2016-10-03T09:11:07+03:00
  [INFO] Final Memory: 14M/114M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project gs-maven: Compilation failure: Compilation failure:
  [ERROR] /H:/Projects/JAVA/web/unzipped/gs-maven/initial/src/main/java/hello/HelloWorld.java:[3,21] package org.joda.time does not exist
  [ERROR] /H:/Projects/JAVA/web/unzipped/gs-maven/initial/src/main/java/hello/HelloWorld.java:[7,9] cannot find symbol
  [ERROR] symbol:   class LocalTime
  [ERROR] location: class hello.HelloWorld
  [ERROR] /H:/Projects/JAVA/web/unzipped/gs-maven/initial/src/main/java/hello/HelloWorld.java:[7,37] cannot find symbol
  [ERROR] symbol:   class LocalTime
  [ERROR] location: class hello.HelloWorld
  [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>Please let me inform what I am doing wrong.</p>
  
  <p>N.B: I am just following <a href="http://spring.io/guides/gs/maven/" rel="nofollow">Building Java Projects with Maven</a> tutorial as a beginner.</p>