maven使用----更新项目时出现版本不对的解决方法

在使用maven时,每次更新,就会发现版本变成了1.5,然后就要一个一个去解决这个问题。令人头大!!

以下是我在网上搜到的解决方法,有3种,在这我只记录自己亲测的一种

一、修改配置文件

我们都知道,在使用maven的时候需要配置本地库,我们现在就是需要修改那个文件里面的东西。

    1、打开%maven%\conf文件夹中的settings.xml文件

    2、将以下代码放在<profiles>标签下

	<profile>
    		<id>jdk-1.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> 

此时,再次更新代码的时候编译版本就变成了1.8的了~


猜你喜欢

转载自blog.csdn.net/hey_mrli/article/details/80820084