title: Using Maven to download dependencies to a directory on the command line
body: <p>I need to download all transitive dependencies of a project to a directory on the command line <strong>without</strong> having a pom.xml file or other script. Ideally I would be able to do this with one or two commands. From what I can tell, this is at least a 2 step process with mvn.</p>
  
  <ol>
  <li>Download dependencies to the local repository</li>
  <li>Copy the dependencies to the lib directory</li>
  </ol>
  
  <p>To get the dependencies I run</p>
  
  <pre><code>$ mvn org.apache.maven.plugins:maven-dependency-plugin:2.6:get -DgroupId=org.jclouds.provider -DartifactId=rackspace-cloudservers-us -Dversion=1.5.8
  </code></pre>
  
  <p>Which works great. Unfortunately the dest param doesn't help me as it won't put all transitive dependencies in the dest.</p>
  
  <p>So now I need to copy that JAR file and all of its transitive dependencies into my lib directory. I know this part has been asked many time on StackOverflow but nothing has worked for my yet. I've tried the following.</p>
  
  <pre><code>$ mvn dependency:copy-dependencies ...
  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:copy-dependencies (default-cli): Goal requires a project to execute but there is no POM in this directory
  </code></pre>
  
  <p>and</p>
  
  <pre><code>$ mvn dependency:copy ...
  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:copy (default-cli): Goal requires a project to execute but there is no POM in this directory
  </code></pre>
  
  <p>From reading the documentation and other answers here on StackOverflow for copy-dependencies and copy I thought I would be able to use them from the command line without a pom.xml but mvn seems to need one. My Maven version is Apache Maven 3.0.4 (r1232337; 2012-01-17 02:44:56-0600).</p>
  
  <p>Can anyone give me an example of copying transitive dependencies using mvn without a pom.xml?</p>
  
  <p>Is there a better way to do what I'm trying accomplish here?</p>