eclipse maven error: Archive for required library in project cannot be read or is not a valid ZIP file

archive for required library cannot be read or is not a valid zip file eclipse
maven error in opening zip file
zip: not a valid zip file
the project cannot be built until build path errors are resolved
not valid zip file
could not read maven project
unable to build maven project in eclipse
eclipse cannot be resolved to a type maven

In an eclipse maven project using spring web mvc, I am getting the following error in the Markers tab:

Archive for required library: 'D:/mypath/.m2/repository/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar' in project 'DocumentManager' cannot be read or is not a valid ZIP file

I have checked, and the jar file is in fact present in the url indicated. I even copied a backup of the jar to overwrite the jar file in that location, but that did not get rid of the error either. I forced maven to update, which did not solve the problem. I also restarted eclipse to no effect.

At one point, jta-1.0.1B.jar had been jta-1.0.1B.jar.LatestUpdate, so I shortened the name to jta-1.0.1B.jar

In pom.xml, the location of the error message is line 2, which reads as follows:

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">  

When I download jta-1.0.1B.jar manually from this url, the error in pom.xml goes away but is replaced with new errors in .java class files indicating that 5 methods of the Document class are not valid.

I read this and this, but I am not using struts, I am already including 3.3.2.ga of hibernate, and I do not have a repository tag in pom.xml (which this said did not even solve the problem anyway), so I do not think this is a duplicate.

Can anyone suggest a way to fix this problem? If I need a repository tag, where do I put it? And what else do I change to accommodate its addition?

For anyone who is curious, my pom.xml is included for reference as follows:

<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <description></description>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0.1</version>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
      <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-orm</artifactId>
      <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
      <groupId>taglibs</groupId>
      <artifactId>standard</artifactId>
      <version>1.1.2</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
      <version>1.1.2</version>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
      <version>3.3.2.GA</version>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.10</version>
    </dependency>
    <dependency>
      <groupId>commons-dbcp</groupId>
      <artifactId>commons-dbcp</artifactId>
      <version>20030825.184428</version>
    </dependency>
    <dependency>
      <groupId>commons-pool</groupId>
      <artifactId>commons-pool</artifactId>
      <version>1.5.4</version>
    </dependency>
    <dependency>
      <groupId>commons-fileupload</groupId>
      <artifactId>commons-fileupload</artifactId>
      <version>1.2.1</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>1.3</version>
    </dependency>
<!-- dependency to fix JSPServletException -->
    <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>jsp-api</artifactId>
        <version>6.0.32</version>
        <scope>provided</scope>               
    </dependency>
  </dependencies>
  <properties>
    <org.springframework.version>3.2.4.RELEASE</org.springframework.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <groupId>DocumentManager</groupId>
  <artifactId>DocumentManager</artifactId>
</project>  

To fix issues like that, let Maven download the files again:

  1. Delete the folder D:/mypath/.m2/repository/javax/transaction/jta
  2. Run Maven with -U so it tries broken downloads again.

That should try to download the file again and clean up any "residue" in your local repository.

If Eclipse still complains that the JAR file is corrupt:

  1. Refresh your project (F5 or from the context menu)
  2. Clean the project
  3. Try to open the JAR file. Maybe it's really corrupt.

If the JAR file is corrupt, delete the folder again and run Maven once more. Note the URLs which Maven used to download the archive and contact the administrator of that site.

Cannot be Read or is Not a Valid ZIP file – How to fix Maven Build Path Error with corrupted .jar file. Last Updated on It took long time to import all of my Java Projects to new Eclipse Workspace. While importing Archive for required library​:  Type Archive for required library: spring-core-4.0.1.RELEASE.jar' in project 'starter' cannot be read or is not a valid ZIP file 0 Archive for rquired library cannot be read or is not a valid ZIP file

You can manually go to the repository specified in the error console that is Archive for required library: '**D:/mypath/.m2/repository/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar**' in project 'DocumentManager' cannot be read or is not a valid ZIP file

Delete the JAR mentioned

Go to eclipse, right click the project and select run as->maven-install. It will download the right jar file.

After that came a few "Invalid ZIP archive" messages. I still see the original Build Path Problem in the Problems view: Archive for required library: At first I didn't get "cannot be read or is not a valid ZIP file" error marking For what it's worth I see the same error for a library jar (inside project A, referenced  Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Learn more Maven Archive cannot be read or is not a valid Zip file?

You should exclude JTA in your hibernate dependency.

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate</artifactId>
    <version>3.2.3.ga</version>
    <exclusions>
        <exclusion>
            <artifactId>javax.transaction</artifactId>
            <groupId>jta</groupId>
        </exclusion>
    </exclusions>
</dependency>

After that, add the jta dependency.

<dependency>
    <groupId>javax.transaction</groupId>
    <artifactId>jta</artifactId>
    <version>1.1</version>
</dependency>

jboss maven (187.20 KB, image/jpeg) in project 'mapencoder' cannot be read or is not a valid ZIP file if I open the Exists some problem when ECLIPSE is downloaded the JAR from any Maven What exactly are you doing? SOLVED: It seemed to be some problem on my computer, I reset it, redownloaded eclipse, I started a new project, redid the pom.xml, and imported the

The problem with me was fixed by going to Build Path-> Configure Build Path-> Libraries-> Remove the jta lib which has small cross mark on it.

I was able to successfully build my project but was getting this error even after project Refresh/Project Clean.

Archive for required library: '/Libraries/jars/hibernate-annotations.jar' in project '​SpotlessColorToolkit' cannot be read or is not a valid ZIP file 10. There is other case to display error Archive for required library. Right click on project and open --> project project properties --> java build path --> Android private libs. if there are two jar files with same name then remove one from libs.

The maven central repository doesn't contain a jar file for the given groupId/artifactId only a pom.xml.

You are using Spring 3.2 so I suggest you simply upgrade hibernate to the most recent version (4.2.6.Final) which should have a reference to jta 1.1. Or simply include the 1.1 version in your pom which does have a jar in maven central.

Steps to correct the Eclipse repository cache state. Correct StreamBase Studio maven error: Archive for required library is not a valid ZIP file in project '​my_project' cannot be read or is not a valid ZIP file. (The error may  Archive For Required Library: ‘.m2/repository/spring-tx-5.0.10.release.jar’ In Project Cannot Be Read Or Is Not A Valid Zip File. Jerry Zhao October 19, 2018 0. When you develop a spring java project with maven, some times you may encounter errors like below. This is a crazy error because the reason is not very clear.

Maven Error Archive for required library cannot be read or is not a valid ZIP file 6 16 2014 4 2 Duration: 1:02 Posted: Jun 16, 2014 > 1. Select project Test1 in the Package Explorer window > 2. Select Properties, Java Build Path, Libraries folder, Add External JARS > 3. Click on tdmext.jar. > > Error: Archive for required library: 'C:<path>/tdmext.jar' in project > 'Test1' cannot be read or is not a valid ZIP file. > > I believe tdmext.jar is valid because I can run the

Solved "Archive for required library: cannot be read or is not a valid ZIP file. Maven ERROR. Discussion in 'Spigot Plugin Development' started  How to fix Java language level errors and issues using maven and IntelliJ - Duration: 3:31. EvilTester - Software Testing 12,360 views

Archive For Required Library: When you develop a spring java project with maven, some times you may encounter errors like below. Since the error message said the target jar file is not a valid ZIP file or can not be read, so first you had Next Post: How To Change STS Eclipse INI File On MacOS  Description Path Resource Location Type Archive for required library: ' / Users / user /. m2 / repository / org / codehaus / groovy / groovy / 2.5. 3 / groovy-2.5. 3. jar ' in project ' backoffice ' cannot be read or is not a valid ZIP file backoffice Build path Build Path Problem

Comments
  • The .LatestUpdate file isn't a jar file. It merely contains a timestamp (among some other things). So basically by renaming this file you created an invalid jar file. Remove the directory from your repository (and that should force Maven to pull in a fresh jar).
  • @M.Deinum Thank you. I followed your instructions and Maven pulled another copy of .LastUpdated and did not include the jar. Sounds like an error at the server level, but how do I work around it to get my jar so my application will run?
  • Thank you and+1 for taking the time to add insight into this old question.
  • Thank you and +1 for adding perspective for future readers of this old posting.