错误:无法在projectorg.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile

时间:2018-11-19 12:34:21

标签: spring eclipse maven spring-boot

我尝试在Eclipse中配置spring框架。并尝试构建示例。它给了我以下错误。

  

[错误]无法在项目springBootHelloWorld上执行目标org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile(默认编译):编译失败

     

[错误]在此环境中未提供编译器。也许您在JRE而非JDK上运行?

     

[错误]无法在项目springBootHelloWorld上执行目标:可以   无法解决项目的依赖关系   com.javaInUse:springBootHelloWorld:jar:0.0.1-SNAPSHOT:以下   工件无法解决:   org.springframework:spring-core:jar:5.0.10.RELEASE,   org.xmlunit:xmlunit-core:jar:2.5.1:无法传输工件   org.springframework:spring-core:jar:5.0.10.RELEASE从/到中央   (https://repo.maven.apache.org/maven2):   C:\ Users \ jkalansrayan.m2 \ repository \ org \ springframework \ spring-core \ 5.0.10.RELEASE \ aether-f4279e83-b0c7-471b-8dca-f684b2238c2d-spring-core-5.0.10.RELEASE.jar-in -进展   (系统找不到指定的文件)-> [帮助1]

POM文件

<?xml version="1.0" encoding="UTF-8"?>
<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.javaInUse</groupId>
<artifactId>springBootHelloWorld</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>springBootHelloWorld</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.0.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
</project>

1 个答案:

答案 0 :(得分:1)

  1. 检查互联网连接,因为这可能是代理问题。

  2. 删除本地Maven .m2仓库文件夹,然后再次执行mvn clean install将解决此问题。

如果上述解决方案不起作用,请在问题中附加pom.xml文件。