title: Ant build classpath jar generates "error in opening zip file"
body: <p>I have a project built in eclipse with a dependencies on 3rd party jars. I'm trying to generate a suitable build file for ant - using eclipses built-in export->ant buildfile feature as a starting block.</p>
  
  <p>When I run the build target I get the following error:</p>
  
  <pre><code>[javac] error: error reading /base/repo/FabTrace/lib/apache/geronimo/specs/geronimo-j2ee-management_1.0_spec/1.0/geronimo-j2ee-management_1.0_spec-1.0.jar; error in opening zip file
  </code></pre>
  
  <p>And the whole build file (auto-generated by eclipse) looks like this:
  (NB: the error above always references the first jar listed in the classpath)</p>
  
  <pre><code>&lt;project basedir="." default="build" name="FabTrace"&gt;
      &lt;property environment="env"/&gt;
      &lt;property name="ECLIPSE_HOME" value="/opt/apps/eclipse"/&gt;
      &lt;property name="debuglevel" value="source,lines,vars"/&gt;
      &lt;property name="target" value="1.5"/&gt;
      &lt;property name="source" value="1.5"/&gt;
      &lt;path id="JUnit 4.libraryclasspath"&gt;
          &lt;pathelement location="${ECLIPSE_HOME}/plugins/org.junit4_4.5.0.v20090824/junit.jar"/&gt;
          &lt;pathelement location="${ECLIPSE_HOME}/plugins/org.hamcrest.core_1.1.0.v20090501071000.jar"/&gt;
      &lt;/path&gt;
      &lt;path id="FabTrace.classpath"&gt;
          &lt;pathelement location="bin"/&gt;
          &lt;pathelement location="lib/apache/geronimo/specs/geronimo-j2ee-management_1.0_spec/1.0/geronimo-j2ee-management_1.0_spec-1.0.jar"/&gt;
          &lt;pathelement location="lib/apache/geronimo/specs/geronimo-jms_1.1_spec/1.0/geronimo-jms_1.1_spec-1.0.jar"/&gt;
          &lt;pathelement location="lib/commons-collections/commons-collections/3.2/commons-collections-3.2.jar"/&gt;
          &lt;pathelement location="lib/commons-io/commons-io/1.4/commons-io-1.4.jar"/&gt;
          &lt;pathelement location="lib/commons-lang/commons-lang/2.1/commons-lang-2.1.jar"/&gt;
          &lt;pathelement location="lib/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/&gt;
          &lt;pathelement location="lib/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar"/&gt;
          &lt;pathelement location="lib/javax/activation/activation/1.1/activation-1.1.jar"/&gt;
          &lt;pathelement location="lib/javax/jms/jms/1.1/jms-1.1.jar"/&gt;
          &lt;pathelement location="lib/javax/mail/mail/1.4/mail-1.4.jar"/&gt;
          &lt;pathelement location="lib/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar"/&gt;
          &lt;pathelement location="lib/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar"/&gt;
          &lt;pathelement location="lib/junit/junit/4.4/junit-4.4.jar"/&gt;
          &lt;pathelement location="lib/log4j/log4j/1.2.15/log4j-1.2.15.jar"/&gt;
          &lt;pathelement location="lib/apache/camel/camel-jms-2.0-M1.jar"/&gt;
          &lt;pathelement location="lib/spring/spring-2.5.6.jar"/&gt;
          &lt;pathelement location="lib/apache/camel/camel-bundle-2.0-M1.jar"/&gt;
          &lt;pathelement location="lib/backport-util-concurrent/backport-util-concurrent-3.1.jar"/&gt;
          &lt;pathelement location="lib/commons-pool/commons-pool-1.4.jar"/&gt;
          &lt;pathelement location="lib/apache/camel/camel-activemq-1.1.0.jar"/&gt;
          &lt;pathelement location="lib/apache/activemq/activemq-camel-5.2.0.jar"/&gt;
          &lt;pathelement location="lib/jencks/jencks-2.2-all.jar"/&gt;
          &lt;pathelement location="lib/jencks/jencks-amqpool-2.2.jar"/&gt;
          &lt;pathelement location="lib/activemq/apache-activemq-5.3.1/activemq-all-5.3.1.jar"/&gt;
          &lt;pathelement location="lib/activemq/apache-activemq-5.3.1/lib/optional/xbean-spring-3.6.jar"/&gt;
          &lt;pathelement location="lib/activemq/apache-activemq-5.3.1/lib/activemq-core-5.3.1.jar"/&gt;
          &lt;pathelement location="lib/activemq/apache-activemq-5.3.1/lib/camel-jetty-2.2.0.jar"/&gt;
          &lt;pathelement location="lib/activemq/apache-activemq-5.3.1/lib/web/jetty-6.1.9.jar"/&gt;
          &lt;pathelement location="lib/activemq/apache-activemq-5.3.1/lib/web/jetty-util-6.1.9.jar"/&gt;
          &lt;pathelement location="lib/activemq/apache-activemq-5.3.1/lib/web/jetty-xbean-6.1.9.jar"/&gt;
          &lt;pathelement location="lib/activemq/apache-activemq-5.3.1/lib/optional/activemq-optional-5.3.1.jar"/&gt;
          &lt;pathelement location="lib/activemq/apache-activemq-5.3.1/lib/web/geronimo-servlet_2.5_spec-1.2.jar"/&gt;
          &lt;pathelement location="lib/activemq/apache-activemq-5.3.1/lib/optional/spring-beans-2.5.6.jar"/&gt;
          &lt;pathelement location="lib/activemq/apache-activemq-5.3.1/lib/optional/spring-context-2.5.6.jar"/&gt;
          &lt;pathelement location="lib/activemq/apache-activemq-5.3.1/lib/optional/spring-core-2.5.6.jar"/&gt;
          &lt;path refid="JUnit 4.libraryclasspath"/&gt;
      &lt;/path&gt;
      &lt;target name="init"&gt;
          &lt;mkdir dir="bin"/&gt;
          &lt;copy includeemptydirs="false" todir="bin"&gt;
              &lt;fileset dir="src/main/java"&gt;
                  &lt;exclude name="**/*.launch"/&gt;
                  &lt;exclude name="**/*.java"/&gt;
              &lt;/fileset&gt;
          &lt;/copy&gt;
          &lt;copy includeemptydirs="false" todir="bin"&gt;
              &lt;fileset dir="src/test/java"&gt;
                  &lt;exclude name="**/*.launch"/&gt;
                  &lt;exclude name="**/*.java"/&gt;
              &lt;/fileset&gt;
          &lt;/copy&gt;
          &lt;copy includeemptydirs="false" todir="bin"&gt;
              &lt;fileset dir="config"&gt;
                  &lt;exclude name="**/*.launch"/&gt;
                  &lt;exclude name="**/*.java"/&gt;
              &lt;/fileset&gt;
          &lt;/copy&gt;
      &lt;/target&gt;
      &lt;target name="clean"&gt;
          &lt;delete dir="bin"/&gt;
      &lt;/target&gt;
      &lt;target depends="clean" name="cleanall"/&gt;
      &lt;target depends="build-subprojects,build-project" name="build"/&gt;
      &lt;target name="build-subprojects"/&gt;
      &lt;target depends="init" name="build-project"&gt;
          &lt;echo message="${ant.project.name}: ${ant.file}"/&gt;
          &lt;javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}"&gt;
              &lt;src path="src/main/java"/&gt;
              &lt;classpath refid="FabTrace.classpath"/&gt;
          &lt;/javac&gt;
          &lt;javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}"&gt;
              &lt;src path="src/test/java"/&gt;
              &lt;classpath refid="FabTrace.classpath"/&gt;
          &lt;/javac&gt;
          &lt;javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}"&gt;
              &lt;src path="config"/&gt;
              &lt;classpath refid="FabTrace.classpath"/&gt;
          &lt;/javac&gt;
      &lt;/target&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>(I know there's eclipse specific stuff in here. But I get the same results with or without it.)</p>
  
  <p>I've done ye old google search and trawled around without success. </p>
  
  <p>I can confirm that all the jars do really exist. I've also tried from the commandline and as sudo - again, same results.</p>
  
  <p>Any help would be greatly appreciated. </p>
  
  <p>Cheers</p>