maven项目两种方式配置本地JDK版本

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhangjq520/article/details/88559689

一、全局配置-修改本地settings.xml文件(本地项目都遵循)

<profile>
	<id>jdk1.8</id>
	<activation>
		<activeByDefault>true</activeByDefault>
		<jdk>1.8</jdk>
	</activation>
	<properties>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
		<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
	</properties>
</profile>

二、修改项目pom.xml文件(此项目)

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


<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>
	<configuration>
		<source>${java.version}</source>
        <target>${java.version}</target>
	</configuration>
</plugin>

猜你喜欢

转载自blog.csdn.net/zhangjq520/article/details/88559689