title: Ant: Exclude files from merged jar file
body: <p>For a java project I'd like to merge all third-party jars it depends on into the main jar created by Apache Ant, which I already managed to do.  </p>
  
  <p>The problem is that some of these jar-files have signature-files in their <code>META-INF</code>-directories, so when I try to run my jar-file, I get the error message <code>"Invalid signature file digest for Manifest main attributes"</code>. After I delete the signature-files manually the error is gone.</p>
  
  <p>I tried to filter the signature files out in my ant-file with an <code>excludes</code>-attribute or an <code>exclude</code>-tag, but nothing seems to have any effect.</p>
  
  <p>This is the ant-task:</p>
  
  <pre><code>&lt;target name="jar" description="Creates the jar file"&gt;
    &lt;mkdir dir="${jar}"/&gt;
    &lt;jar destfile="${jar}/${ant.project.name}.jar" level="9" filesetmanifest="mergewithoutmain"&gt;
      &lt;zipgroupfileset dir="${lib}" includes="*.jar"/&gt;
      &lt;zipfileset dir="${class}"/&gt;
      &lt;manifest&gt;
        &lt;attribute name="Main-Class" value="${mainclass}"/&gt;
      &lt;/manifest&gt;
    &lt;/jar&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>How can I filter files from the resulting jar in this ant-task? Thanks for your help!</p>