IntelliJ IDEA编译错误Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile

    技术2022-07-13  89

    SDK版本一致

    右键点击项目名,打开Open Module Settings:

    在项目的pom.xml中加入以下代码

    <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> <configuration> <verbose>true</verbose> <fork>true</fork> <executable>${JAVA8_HOME}/bin/javac</executable> </configuration> </plugin> </plugins>

    修改settings.xml文件(\apache-maven-3.6.1\conf\settings.xml)

    <profiles> <profile> <id>custom1-compiler</id> <properties><JAVA8_HOME>D:\Java\jdk8\jdk1.8.0_171</JAVA8_HOME></properties> </profile> </profiles> <activeProfiles> <activeProfile>custom1-compiler</activeProfile> </activeProfiles>

    完成上面步骤后,Idea会自动自成一个Profiles选项,不用管它,再次执行打包命令package即可。

    参考

    https://blog.csdn.net/u013020593/article/details/105478472

    Processed: 0.013, SQL: 9