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

后端 未结 7 2078
北海茫月
北海茫月 2021-01-02 08:08

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/reposi         


        
相关标签:
7条回答
  • 2021-01-02 08:37

    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>
    
    0 讨论(0)
  • 2021-01-02 08:37

    Tried with 1.5.5 Release jar and it worked for me

    <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.5.RELEASE</version>
    

    https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent/1.5.5.RELEASE

    0 讨论(0)
  • 2021-01-02 08:40

    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.

    0 讨论(0)
  • 2021-01-02 08:44

    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.

    0 讨论(0)
  • 2021-01-02 08:48

    To fix this issue simply.

    1. select all libraries in "Maven Dependencies" of related project.
    2. just do "Refresh" of mouse right button...

    The reason is cache info, so just refresh the information.

    0 讨论(0)
  • 2021-01-02 08:49

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

    maven central results

    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.

    0 讨论(0)
提交回复
热议问题