java - 无效的代码长度集和无效的 LOC 标头错误 - Maven
问题描述
我有一个 Maven 项目,它在运行 Maven 安装时返回以下堆栈跟踪:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.508 s
[INFO] Finished at: 2018-09-12T01:07:16-05:00
[INFO] Final Memory: 18M/64M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ExampleMvc: Compilation failure: Compilation failure:
[ERROR] error reading /Users/vismarkjuarez/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.32/tomcat-embed-core-8.5.32.jar; ZipFile invalid LOC header (bad signature)
[ERROR] error reading /Users/vismarkjuarez/.m2/repository/org/springframework/spring-web/5.0.8.RELEASE/spring-web-5.0.8.RELEASE.jar; ZipFile invalid LOC header (bad signature)
[ERROR] /Users/vismarkjuarez/eclipse-workspace/ExampleMvc/src/main/java/com/boot/training/ExampleMvc/App.java:[1,1] cannot access com.boot.training.ExampleMvc
[ERROR] invalid code lengths set
[ERROR] /Users/vismarkjuarez/eclipse-workspace/ExampleMvc/src/main/java/com/boot/training/ExampleMvc/ExampleController.java:[7,8] cannot access java.lang
[ERROR] invalid code lengths set
[ERROR] /Users/vismarkjuarez/eclipse-workspace/ExampleMvc/src/main/java/com/boot/training/ExampleMvc/ExampleController.java:[6,2] cannot find symbol
[ERROR] symbol: class RestController
[ERROR] /Users/vismarkjuarez/eclipse-workspace/ExampleMvc/src/main/java/com/boot/training/ExampleMvc/ExampleController.java:[10,16] cannot find symbol
[ERROR] symbol: class String
[ERROR] location: class com.boot.training.ExampleMvc.ExampleController
[ERROR] -> [Help 1]
我已经尝试更新项目并强制更新快照和版本,但似乎没有任何效果。
下面是我的 pom.xml 文件:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.boot.training</groupId>
<artifactId>ExampleMvc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ExampleMvc</name>
<url>http://maven.apache.org</url>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.0.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.0.4.RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
我究竟做错了什么?以上错误是什么意思?
解决方案
尝试以下选项:
确保你有 java 8 集。例如在运行配置下的 eclipse 中检查 jre 指向的位置。如果不指向 java 8 ,则将其指向 java 8。
如果步骤 1 不起作用,请删除 your.m2/repository 文件夹并进行全新安装
推荐阅读
- mysql - MariaDB:某些字符串长度的 MySQL 连接器/Python 更新失败
- c++ - 如何检测 C++ 中是否按下了任何键?
- firebase - 在 .where 中进行比较时,如何忽略日期对象上的时间或时区?
- android - 安装 Firebase X 后无法使用 cordova 运行 Ionic 4 应用程序
- html - 如何将菜单中的最后一个 li 定位为在悬停内容之前不显示?
- java - 如何在 Java 中使用 SDK 更新计划独立需求
- javascript - 为什么 npm start 不适用于 React JS?
- php - Laravel 重定向到 naimed 路由,参数未按预期工作,我可能做错了什么吗?
- c# - 为什么日期格式有时在调试器中不起作用?
- yolo - 在 2 个课程上训练暗网,但 mAP 下降?