title: Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils
body: <p>I am testing out maven and its capabilities. I am trying to write a string to a text file using commons-io  </p>
  
  <pre><code>import org.apache.commons.io.FileUtils;
  ...
  public void writeToFile(String fileName){
      File file = new File(fileName);
      ...
      FileUtils.writeStringToFile(file,rowEntry); //rowEntry is a String
  }  
  </code></pre>
  
  <p>I have added the commons-io to the dependencies  </p>
  
  <p><strong>POM.xml</strong>  </p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;commons-io&lt;/groupId&gt;
      &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
      &lt;version&gt;2.5&lt;/version&gt;
   &lt;/dependency&gt;  
  </code></pre>
  
  <p>It compiles but it throws an exception when I run it</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils
  at com.RandCollections.StringFinder.writeToFile(StringFinder.java:704)
  at com.RandCollections.StringFinder.menu(StringFinder.java:123)
  at com.RandCollections.StringFinderMain.main(StringFinderMain.java:28)
  Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils
  at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  ... 3 more   
  </code></pre>
  
  <p>I think Im missing out on some things, can you help point it out please?</p>