源值1.5已过时,将在未来所有版本中删除--解决办法

在IDEA中,每次运行项目总是出现提示:
源值1.5已过时,将在未来所有版本中删除。

解决办法:

全局配置

全局配置
全局配置是指在KaTeX parse error: Expected 'EOF', got '\conf' at position 13: {MAVEN_HOME}\̲c̲o̲n̲f̲\settings.xml中进…{MAVEN_HOME}指的是maven的安装目录。例如,要配置jdk1.8,打开settings.xml这个文件,然后在 之间添加如下代码。

<profile>
	<id>jdk18</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>

全局配置的好处就是省事、方便。一次配置以后,再使用maven构建项目,项目编译时,默认使用jdk1.8进行编译。

局部配置:

在pom.xml文件中加入下列代码:

<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<configuration>
				<source>1.7</source>
				<target>1.7</target>
			</configuration>
		</plugin>
	</plugins>
</build>
或者:

    <properties>
     <maven.compiler.source>1.8</maven.compiler.source>
      <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

另外,注意自己IDEA的配置:
1.打开IDEA中的setting,找到 Java compiler 设置成你的jdk版本;
2.打开Project Structure,找到modules中设置 module sdk
源值1.5已过时,将在未来所有版本中删除--解决办法
源值1.5已过时,将在未来所有版本中删除--解决办法

源值1.5已过时,将在未来所有版本中删除--解决办法