title: How to Copy Bundle-classpath jars and their dependencies from maven repo to my local lib folder?
body: <p>We are developing an <strong>Eclipse RCP</strong> application. We decided to use <strong>SVN</strong> for revision control system. We could export an eclipse product in the eclipse environment. Everything worked fine.</p>
  
  <p>But,</p>
  
  <p>Some of our plugins have dependencies to regular java jars using <strong>bundle-classpath</strong> in their manifest.mf. Up to now we were committing those jars into SVN repository. We "heard" that it is wrong to commit jars into svn and we should use <strong>maven-tycho</strong> and put those jars into a maven repository for this purpose.</p>
  
  <p>So we moved the jars from SVN repository to Maven repository. Then we wanted to setup a fresh dev environment, we checked out projects from svn and they had compilation errors because we do not have jars!</p>
  
  <p>We used <strong>m2eclipse</strong> and define all dependencies in my freshly created <strong>pom.xml</strong> files. <strong>maven-dependency-plugin's copy goal</strong> and list all the jars and then we run mvn validate to get the jars into our lib folder. It worked but it seems to me a bit ugly. Because my plugin's pom.xml looks like defining every dependency twice:</p>
  
  <pre><code>&lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.1&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;copy-bundle-classpath-libs&lt;/id&gt;
                      &lt;phase&gt;validate&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;copy&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;outputDirectory&gt;lib&lt;/outputDirectory&gt;
                          &lt;overWriteReleases&gt;true&lt;/overWriteReleases&gt;
                          &lt;overWriteSnapshots&gt;true&lt;/overWriteSnapshots&gt;
                          &lt;overWriteIfNewer&gt;true&lt;/overWriteIfNewer&gt;
                          &lt;stripVersion&gt;true&lt;/stripVersion&gt;
                          &lt;artifactItems&gt;
                              &lt;artifactItem&gt;
                                  &lt;groupId&gt;MyGroup&lt;/groupId&gt;
                                  &lt;artifactId&gt;MyJar&lt;/artifactId&gt;
                                  &lt;version&gt;SNAPSHOT&lt;/version&gt;
                              &lt;/artifactItem&gt;
                          &lt;/artifactItems&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;MyGroup&lt;/groupId&gt;
          &lt;artifactId&gt;MyJar&lt;/artifactId&gt;
          &lt;version&gt;SNAPSHOT&lt;/version&gt;
          &lt;type&gt;pom&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>Is there a way to get rid of this?</p>
  
  <p>Besides if MyJar.pom has other dependencies I need them too in my local lib. Is there a way to <strong>copy those transitive dependencies to my local lib folder</strong>?</p>
  
  <p>I tried <strong>copy-dependencies goal</strong> but it tries to find my other plugins' jars that my plugin depends on. I just need the regular jars to be copied to my local lib. My other plugins are already there side by side with all their source code as a plugin project. I do not need their jars. Can I filter those out? I tried this without success:</p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;excludeGroupIds&gt;MyGroup&lt;/excludeGroupIds&gt;
                  &lt;outputDirectory&gt;lib&lt;/outputDirectory&gt;
                  &lt;overWriteReleases&gt;true&lt;/overWriteReleases&gt;
                  &lt;overWriteSnapshots&gt;true&lt;/overWriteSnapshots&gt;
                  &lt;overWriteIfNewer&gt;true&lt;/overWriteIfNewer&gt;
                  &lt;stripVersion&gt;true&lt;/stripVersion&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;copy-dependencies&lt;/id&gt;
                      &lt;phase&gt;validate&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;copy-dependencies&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>Thanks</p>