title: Copying dependencies into local repo as a Jar and including the Jar as classpath using appassembler-maven-plugin
body: <p>I'm using latest version of Maven, and earlier I was trying to include a particular dependency (call it dependency <code>A</code>) into a multi-module project (Java Web App using Tomcat and another Java project) in Windows by testing it locally, and create the normal Java project to be runnable using a <code>.bat</code> script using the <a href="http://www.mojohaus.org/appassembler/appassembler-maven-plugin/assemble-mojo.html" rel="nofollow noreferrer">Appasembler plugin <code>appasemble</code> command</a> in my POM. But it turns out dependency <code>A</code> has a lot of dependencies it include, and the <code>.bat</code> script generated exceeds the length limit it can execute due to lots of classpath being included.
  So I decided to package it inside a jar, and reference all libraries in a single jar from a single place and exclude the existing classpaths by using the <code>maven-dependency-plugin</code> and <code>copy</code> goal :</p>
  
  <pre><code>&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
  &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.10&lt;/version&gt; 
                  &lt;execution&gt;
                      &lt;id&gt;copy&lt;/id&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;copy&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                        &lt;!--Below this is the dependency `A` --&gt;
                          &lt;artifactItems&gt;
                              &lt;artifactItem&gt;
                                  &lt;groupId&gt;org.deeplearning4j&lt;/groupId&gt;
                                  &lt;artifactId&gt;deeplearning4j-nlp&lt;/artifactId&gt;
                                  &lt;version&gt;${dl4j.version}&lt;/version&gt;
                                  &lt;type&gt;jar&lt;/type&gt;
                                  &lt;overWrite&gt;true&lt;/overWrite&gt;
                                        &lt;outputDirectory&gt;${project.basedir}/localrepo&lt;/outputDirectory&gt;
  
                                  &lt;destFileName&gt;deeplearninglib&lt;/destFileName&gt;
  
                              &lt;/artifactItem&gt;
  
                          &lt;/artifactItems&gt;
  
                          &lt;localRepositoryDirectory&gt;${project.basedir}\localrepo&lt;/localRepositoryDirectory&gt;
  
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>It successfully created the jar with all its dependencies. Now I'm trying to include the jar into my classpath generated in my <code>.bat</code> script, but when I take a look at <code>appassembler:assemble</code> documentation, there's no such command to exclude the existing classpaths that are already in new jar and including the newly packaged jar to the <code>.bat</code> script.
  So is there any way I can include newly packaged jar as classpath and exclude the classpaths that are already included in the newly pacakaged jar from the launchable <code>.bat</code> script?</p>
  
  <p><strong>EDIT</strong> : As a temporary fix, I managed to fix the long classpath issue by using wildcards and flattening the directory layout by including :</p>
  
  <pre><code> &lt;repositoryLayout&gt;flat&lt;/repositoryLayout&gt;
   &lt;useWildcardClassPath&gt;true&lt;/useWildcardClassPath&gt;
  </code></pre>
  
  <p>to the <code>appassembler</code> plugin. However, the question still remains open as this has still not answered the main question.</p>