1

I've following dependencies in my pom.xml.

<dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
    </dependency>
   <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>6.0.2</version>
    </dependency>
   <dependency>
        <groupId>com.jayway.restassured</groupId>
        <artifactId>rest-assured</artifactId>
        <version>2.4.0</version>
    </dependency>

when i do mvn test the console output is as follows:

[ERROR] error reading C:\Users\harish\.m2\repository\com\jayway\restassured\rest-assured\2.4.0\rest-assured-2.4.0.jar; error in opening zip file
[ERROR] error reading C:\Users\harish\.m2\repository\mysql\mysql-connector-java\6.0.2\mysql-connector-java-6.0.2.jar; error in opening zip file
[ERROR] error reading C:\Users\harish\.m2\repository\junit\junit\4.12\junit-4.12.jar; error in opening zip file

These are the error showed up. I've no idea hot to resolve my project issue. I searched for several solutions through online. but, didn't help. If anyone know the reason for this kind of errors,please help. Thanks in advance.

krish
  • 349
  • 3
  • 17
  • 1
    Unrelated, but you might consider adding `test` to your junit dependency to indicate "the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." – dnault Jul 19 '16 at 20:58
  • 1
    Wild guess: you are behind a proxy and it screwed up the downloading of the dependencies. Remove them (each folder like `~\.m2\repository\junit\junit\4.12`), correctly set up the proxy and try again. – Tunaki Jul 19 '16 at 20:59
  • Just a doubt. can i remove all the folders in repo? – krish Jul 19 '16 at 21:10

1 Answers1

-1

Try removing your ~/.m2/repository directory and then running mvn clean install in your project directory.

m_kinsey
  • 194
  • 10
  • Do you want me to remove whole repo? `Archive for required library: C:/Users/harish/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.3.5.RELEASE/spring-boot-autoconfigure-1.3.5.RELEASE.jar' in project 'functional-tests' cannot be read or is not a valid ZIP file functional-tests` I removed `1.3.5 RELEASE` in `.m2` and i did maven update. but still i'm gettig the same error. – krish Jul 19 '16 at 20:59
  • Yeah, blow it away. That directory is your local cache of JARs downloaded from Maven Central (or other remote repositories). Deleting it will force Maven to download fresh copies of all the JARs. (Or if you're nervous, back it up by moving it somewhere else). – dnault Jul 19 '16 at 21:01
  • Only delete your m2 directory if you don't have dependencies that cannot be found on the web/nexus server. Else you are fruited. By the way... This question has been asked so much on stackoverflow already... – Rens Groenveld Jul 19 '16 at 21:19
  • I deleted the JARs in maven repository but still the error remains same. – krish Jul 20 '16 at 01:35
  • Comment without explaining the purpose and it does not work either. – Hammad Dar Mar 14 '19 at 11:19