title: NoClassDefError: SnakeYAML, with Maven
body: <p>I'm having a runtime issue occurring with SnakeYAML and maven. For some reason, I'm getting a <code>java.lang.NoClassDefFoundError</code> with <code>Yaml</code> when I run my .jar.</p>
  
  <p>Here is the stack trace:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/yaml/snakeyaml/Yaml
      at my.package.TimberServer.loadConfiguration(TimberServer.java:56)
      at my.package.TimberServer.&lt;init&gt;(TimberServer.java:38)
      at my.package.Main.main(Main.java:17)
  Caused by: java.lang.ClassNotFoundException: org.yaml.snakeyaml.Yaml
      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      ... 3 more
  </code></pre>
  
  <p>Here is the section in my <code>pom.xml</code> in which I declare the dependency (<a href="http://mvnrepository.com/artifact/org.yaml/snakeyaml/1.4" rel="nofollow">link to central repository</a>):</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.yaml&lt;/groupId&gt;
          &lt;artifactId&gt;snakeyaml&lt;/artifactId&gt;
          &lt;version&gt;1.14&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>I don't declare any repository for it.</p>
  
  <p>Here is the code that calls (and imports) the Yaml class:</p>
  
  <pre><code>import org.yaml.snakeyaml.Yaml;
  // everything else is imported, yes
  
  public class TimberServer {
  
      public void loadConfiguration() throws IOException {
          Yaml yaml = new Yaml(); // Error occurs HERE.
          Map config = (Map) yaml.load(FileUtils.readFileToString(this.config));
          Map&lt;String, String&gt; serverConfig = (Map&lt;String, String&gt;) config.get("server");
      }
  }
  </code></pre>
  
  <p>I get no errors when compiling with maven, which is the most confusing part to me - does Java not check for existent classes? I'm programming with an IDE (IntelliJ), which does not give any errors or warnings with the lines of code.</p>