maven-compiler-plugin:3.1:Eclipse 中的编译(1 个错误)[重复]

问题描述 投票:0回答:1

我想学习Java Spring,所以我选择Eclipse Mars2版本,我想使用Maven构建一个Java项目。但我收到错误

maven-compiler-plugin:3.1:compile(1 errors)
maven-compiler-plugin:3.1:testCompile(1 errors)

然后我在 Windows 10 64 位系统变量中检查 Maven 和 Java 路径。我是这样配置的:

JAVA_HOME => C:\Program Files\Java\jdk1.8.0_71
M2_HOME => C:\apache-maven
MAVEN_HOME => C:\apache-maven

并在系统变量路径中:

%JAVA_HOME%\bin
%M2_HOME%\bin

一切都很好,我通过

java -version
mvn-version
检查过 另外,我已经在Eclipse中安装了mvn插件
install new software
对马文:

名称:m2e 地点:http://download.eclipse.org/technology/m2e/releases

但是错误仍然出现。接下来我可以尝试什么?

更新

我测试构建一个项目maven-archetype-quickstart版本1.1

execution default-compile, in Access/pom.xml
execution default-testCompile, in Access/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.tresnamuda</groupId>
  <artifactId>access</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

<name>access</name>
  <url>http://maven.apache.org</url>

<properties>
 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
 <dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>3.8.1</version>
  <scope>test</scope>
 </dependency>
 </dependencies>
</project>

Eclipse 在第一行检测到错误,即:

 project xmlns="http://maven.apache.org/POM/4.0.0"  .....

也在第 8 行。

这是完整的错误:

java eclipse spring maven
1个回答
1
投票

您的本地存储库似乎已损坏。 请尝试:

  • 删除本地仓库,如果使用Windows则删除文件夹
    C:\Users\your-user-name\.m2\repository
  • 在 Eclipse 中,右键单击项目名称,然后单击 Maven\Update project ...(或使用热键 ALT+F5)
© www.soinside.com 2019 - 2024. All rights reserved.