0

I have recently installed Spring Tool Suite 4.0.1 on Ubuntu 18.04 and tried to run hello world spring application but it gives the following compile-time error. I have searched on google a lot but cannot find the relevant info. Error:

"Description Resource Path Location Type Archive for required library: '/home/anshul/.m2/repository/org/springframework/spring-test/5.1.2.RELEASE/spring-test-5.1.2.RELEASE.jar' in project 'demo' cannot be read or is not a valid ZIP file"

Anshul
  • 11
  • 3
  • Try to downgrade the version of the parrent : spring-boot-starter-parent, i think you use 2.1.0.RELEASE ? try to change it by 2.0.0.RELEASE and tel me – Abder KRIMA Nov 17 '18 at 21:44
  • what is your gradle or maven version and jdk? – Ryuzaki L Nov 18 '18 at 02:00
  • @TinyOS Yeah, it worked! But can you please give a detailed explanation of why I was wrong. Also, it is now giving a cryptic warning: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 – Anshul Nov 18 '18 at 13:15
  • @Deadpool 1.8 & 0.0.1-SNAPSHOT – Anshul Nov 18 '18 at 13:27

1 Answers1

1

It looks like the JAR file in your local Maven repository is corrupted. The easiest way to solve this is to completely wipe out the local Maven repo (delete everything under .m2/repository and kick off an Update Maven Project... in STS. That will trigger Maven to download the dependencies again.

Martin Lippert
  • 5,988
  • 1
  • 15
  • 18
  • But how can JAR file be corrupted. I just followed the simple steps: Download the tar.gz file from spring.io and then just extract it. – Anshul Nov 18 '18 at 13:20
  • We all wonder about this. It is just a fact of life that files in the local maven repository may get corrupted from time to time. Maybe its because an error that happened during download, or some bug in maven or eclipse m2e maven tooling. Or... who knows. Frustrating, I know. Fortunately, the problem is usually easily remedied by deleting the local repo (or even more selectively, just delete only the 'bad' artefact. – Kris Nov 19 '18 at 17:18