修改 maven项目 默认java版本,
修改 maven项目 默认java版本,
在maven-update project后又会变成默认的1.5版本,甚为烦恼。如题:maven构建的项目中默认的Java版本是1.5,并且我们在项目属性里面更改了之后,
下面提供解决方法:
1:在maven的setting.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>
2:在项目的pom.xml文件中设置
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
相关文章
- 暂无相关文章
用户点评