title: Can Maven collect all the dependent JARs for a project to help with application deployment?
body: <p>I'm just starting to use <a href="http://en.wikipedia.org/wiki/Apache_Maven" rel="noreferrer">Maven</a>, (evaluating it, really) and I need to be able to quickly generate a <a href="http://en.wikipedia.org/wiki/JAR_file" rel="noreferrer">JAR</a> file for my application and a directory with all the dependencies (for example, lib) so that I can deploy those two to be run in a stand-alone manner.  Generating the JAR file with the proper manifest is easy, but I do not know how to get Maven to copy the dependencies for the current project into a <code>lib</code> directory that I can deploy.  </p>
  
  <p>Since this is for a stand-alone Java applications, I am <em>not</em> interested in deploying to a Maven repository, that is also fairly trivial, or at least easily googleable.</p>
  
  <p>I've found out how to do everything <em>except</em> copy the dependent JAR files into some specified directory.  This is the workflow I'm looking for:</p>
  
  <pre><code>$ mvn clean
  $ mvn package
  $ cp -r target/{lib,myApp.jar} installLocation
  </code></pre>
  
  <p>Then, running <code>myApp.jar</code> from <code>installLocation</code> as a JAR file should "just work" regardless of my <code>$CLASSPATH</code>.</p>
  
  <p>To try and pre-empt some answers:</p>
  
  <ul>
  <li>I do have a Main-class: set, and it works fine.</li>
  <li>I've also set the classpath in the MANIFEST.MF, and that works fine too.</li>
  <li>I've found out how to use <code>&lt;classpathPrefix&gt;</code> and <code>&lt;classpathMavenRepositoryLayout&gt;</code> to make this work -- but only on my machine. (via: <code>&lt;classpathPrefix&gt;${settings.localRepository}&lt;/classpathPrefix&gt;</code>)</li>
  </ul>