title: Ant including both jar files and .class files in dest jar
body: <p>I have defined a jar task using ant <code>build.xml</code>. I need to bundle all the dependencies into my jar. I don't understant why ant extracts the jars and includes both <code>.jar</code>s and <code>.class</code> files into my jar. It unnecessarily increases the size of my jar file. Here is my jar task.</p>
  <pre><code>&lt;jar destfile=&quot;build/main/ERS2SupportingUtilities.jar&quot;&gt;
              
              &lt;fileset dir=&quot;target/classes&quot;&gt;
                  &lt;exclude name=&quot;*.sh&quot;/&gt;
              &lt;/fileset&gt;
  
              &lt;restrict&gt;
               &lt;name name=&quot;**/*.class&quot;/&gt;
               &lt;archives&gt;
                 &lt;zips&gt;
                   &lt;fileset dir=&quot;./src/main/resources/lib&quot; includes=&quot;**/*.jar&quot;/&gt; 
                 &lt;/zips&gt;
               &lt;/archives&gt;
              &lt;/restrict&gt;
  
              &lt;manifest&gt;
                &lt;attribute name=&quot;Main-Class&quot; value=&quot;com.cibc.ers2.invoker.JobTest&quot;/&gt;
                  &lt;attribute name=&quot;Class-Path&quot; value=&quot;./lib/log4j-1.2.16.jar
                                                      ./lib/org.springframework.context-3.0.3RELEASE.jar
                                                      ./lib/org.springframework.asm-3.0.3.RELEASE.jar
                                                      ./lib/junit-4.7.jar
                                                      ./lib/org.springframework.orm-3.0.3.RELEASE.jar
                                                      ./lib/org.springframework.transaction-3.0.3.RELEASE.jar
                                                      ./lib/org.springframework.aspects-3.0.3.RELEASE.jar
                                                      ./lib/commons-pool-1.5.4.jar
                                                      ./lib/org.springframework.core-3.0.3.RELEASE.jar
                                                      ./lib/commons-logging-1.1.1.jar
                                                      ./lib/HashUtility.jar
                                                      ./lib/org.springframework.expression-3.0.3.RELEASE.jar
                                                      ./lib/commons-lang-2.6.jar
                                                      ./lib/org.springframework.instrument-3.0.3.RELEASE.jar
                                                      ./lib/mockito-all-1.9.5.jar
                                                      ./lib/com.springsource.org.aopalliance-1.0.0.jar
                                                      ./lib/ojdbc14.jar
                                                      ./lib/commons-io-2.4.jar
                                                      ./lib/commons-collections-3.1.jar
                                                      ./lib/org.springframework.jdbc-3.0.3.RELEASE.jar
                                                      ./lib/spring-batch-infrastructure-2.1.9.RELEASE.jar
                                                      ./lib/org.springframework.context.support-3.0.3.RELEASE.jar
                                                      ./lib/commons-dbcp-1.4.jar
                                                      ./lib/spring-batch-test-2.1.9.RELEASE.jar
                                                      ./lib/org.springframework.beans-3.0.3.RELEASE.jar
                                                      ./lib/org.springframework.oxm-3.0.3.RELEASE.jar
                                                      ./lib/org.springframework.aop-3.0.3.RELEASE.jar
                                                      ./lib/commons-beanutils.jar
                                                      ./lib/org.springframework.binding-2.1.1.RELEASE.jar
                                                      ./lib/spring-batch-core-2.1.9.RELEASE.jar
                                                      ./lib/org.springframework.test-3.0.3.RELEASE.jar
                                                      ./launch-context.xml
                                                      ./log4j.xml&quot;
                  /&gt;
              &lt;/manifest&gt;
          &lt;/jar&gt;
  </code></pre>
  <p>I have also tried <code>zipgroupfileset</code> but that also is giving the same problem.</p>
  <h2>EDIT</h2>
  <p>Apologies for not giving enough info about what I am trying to achieve. I have got an application which I am compilint @ <code>target/classes</code>. I need to package this application including my class files and dependecies into one jar.</p>