我有一个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>
我在做什么错?以上错误是什么意思?
答案 0 :(得分:0)
尝试以下选项:
确保已设置Java 8。例如,在eclipse中,在运行配置下检查jre指向的位置。如果未指向Java 8,则将其指向Java 8。
如果第1步不起作用,请删除your.m2 / repository文件夹并进行全新安装
答案 1 :(得分:0)
似乎您刚刚下载了一个损坏的文件。删除.m2存储库目录并更新Maven项目将解决该问题。
请参见this