error reading tomcat-embed-core.jar; zip file is empty

The issue:

When we were trying to set up the spring boot application we got into this issue. This embed-tomcat jar is empty issue is trivial but it’s worth to write it down what’s the reason and how to fix. The issue states the reason into it’s error message.

What’s the reason?

We had multiple java projects running on ubuntu. Most of the project uses sprint boot. When we tried a new setup of sprint-boot it tried do download the embed-tomcat but the downloaded embed-tomcat jar was empty. So, when we tried to run the spring boot it could not start the embed-tomcat.

Size   Date            File
   0 Jan 30 17:11 tomcat-embed-core-9.0.14.jar
 526 Jan 30 17:12 tomcat-embed-core-9.0.14.jar.lastUpdated
  40 Jan 30 17:11 tomcat-embed-core-9.0.14.jar.sha1
1778 Jan 30 17:06 tomcat-embed-core-9.0.14.pom
 526 Jan 30 17:06 tomcat-embed-core-9.0.14.pom.lastUpdated
  40 Jan 30 17:06 tomcat-embed-core-9.0.14.pom.sha1

What’s the solution?

We had to remove that empty embed-tomcat jar from the dependency and run the dependency again. Please do not remove all the dependencies for this.

Please suggest to clean the dependencies but it’s really not needed if you which dependency has the issue.