Spring Boot tomcat-embed-core-9.0.21.jar:zip 文件为空

Posted

技术标签:

【中文标题】Spring Boot tomcat-embed-core-9.0.21.jar:zip 文件为空【英文标题】:Spring Boot tomcat-embed-core-9.0.21.jar: zip file is empty 【发布时间】:2019-11-30 16:00:22 【问题描述】:

我有简单的 Springboot 应用程序,但每当我尝试运行该应用程序时 我收到以下错误,我尝试过 mvn clean install,也尝试过重新导入和Generate Sources and Update Folder options

/Users/a0r00rf/Downloads/SpringStartedCRUD/demoCRUD/src/main/java/com/abhimanyu/demoCRUD/com/abhimanyu/demoCRUD/com/abhimanyu/demoCRUD/services/EmployeeServiceImpl.java
Error:(1, 1) java: cannot access com.abhimanyu.demoCRUD.com.abhimanyu.demoCRUD.com.abhimanyu.demoCRUD.services
Error reading file /Users/a0r00rf/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.21/tomcat-embed-core-9.0.21.jar: zip file is empty
/Users/a0r00rf/Downloads/SpringStartedCRUD/demoCRUD/src/main/java/com/abhimanyu/demoCRUD/com/abhimanyu/demoCRUD/com/abhimanyu/demoCRUD/services/EmployeeService.java
Error:(1, 1) java: cannot access com.abhimanyu.demoCRUD.com.abhimanyu.demoCRUD.com.abhimanyu.demoCRUD
Error reading file /Users/a0r00rf/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.21/tomcat-embed-core-9.0.21.jar: zip file is empty
Error:(7, 8) java: cannot access java.lang
Error reading file /Users/a0r00rf/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.21/tomcat-embed-core-9.0.21.jar: zip file is empty ```

【问题讨论】:

你如何运行这个应用程序?你能在 gihub 中显示这个项目的位置吗? 显示有关您的 pom.xml 的更多详细信息 你能解决这个错误吗?我也面临同样的问题! 【参考方案1】:

.m2/repository下找到Tomcat,将其删除,然后再次mvn install

【讨论】:

您可以通过find $HOME/.m2/repository -iname "*.jar" -size 0 -exec rm \;快速找到并删除空罐子

以上是关于Spring Boot tomcat-embed-core-9.0.21.jar:zip 文件为空的主要内容,如果未能解决你的问题,请参考以下文章

Spring Boot 2Spring Boot CLI

为啥 Spring Boot 应用程序 pom 同时需要 spring-boot-starter-parent 和 spring-boot-starter-web?

《02.Spring Boot连载:Spring Boot实战.Spring Boot核心原理剖析》

spring-boot-quartz, 依赖spring-boot-parent

spring-boot系列:初试spring-boot

Spring Boot:Spring Boot启动原理分析