Maven安装时出现编译错误我该如何解决此错误

时间:2019-07-23 11:21:08

标签: java maven spring-boot jpa

我的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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.6.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>org.o7planning</groupId>
    <artifactId>springBootSecurityJPA-1</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>springBootSecurityJPA-1</name>
    <description>Spring Boot+Spring Security+JPA+Rmember Me</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-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>

控制台是

  

编译错误:[信息]   -------------------------------------------------- ----------- [错误]在此环境中未提供编译器。也许你在跑步   在JRE而不是JDK上? [错误]无法执行目标   org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile   (默认编译)在项目springBootSecurityJPA-1上:编译   失败

1 个答案:

答案 0 :(得分:-1)

该错误表明您正在使用JRE而不是JDK。检查您的JAVA_HOME变量。

https://www.baeldung.com/maven-java-home-jdk-jre