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

SDK版本一致

右键点击项目名,打开Open Module Settings:
IntelliJ IDEA编译错误Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile_第1张图片

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

 <plugins>
 	<plugin>
		<groupId>org.springframework.bootgroupId>
		<artifactId>spring-boot-maven-pluginartifactId>
	plugin>
	<plugin>
		<groupId>org.apache.maven.pluginsgroupId>
		<artifactId>maven-compiler-pluginartifactId>
		<version>3.8.1version>
		<configuration>
			<verbose>trueverbose>
			<fork>truefork>
			<executable>${JAVA8_HOME}/bin/javacexecutable>
		configuration>
	plugin>
plugins>

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

<profiles>
	<profile>
		<id>custom1-compilerid>
		<properties><JAVA8_HOME>D:\Java\jdk8\jdk1.8.0_171JAVA8_HOME>properties>
	profile>
profiles>
<activeProfiles>
	<activeProfile>custom1-compileractiveProfile>
activeProfiles>

完成上面步骤后,Idea会自动自成一个Profiles选项,不用管它,再次执行打包命令package即可。
IntelliJ IDEA编译错误Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile_第2张图片

参考

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

你可能感兴趣的:(Java)