最近搞了個(gè)試驗(yàn)項(xiàng)目,老是發(fā)現(xiàn),一update project就build path中的java版本就編程了1.5
明顯不能這樣啊
eclipse在maven管理項(xiàng)目的時(shí)候會(huì)吧java的版本一同管理了
那么要得到應(yīng)有的java版本則要配置一下maven的配置文件
1. 全局配置
- setting.xml
<profiles> //profiles標(biāo)簽
//在setting.xml中找到profiles標(biāo)簽添加如下內(nèi)容
<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>
</profiles>
2.配置項(xiàng)目
- pom.xml
<project>
//在project標(biāo)簽下配置如下內(nèi)容
<build> 手動(dòng)修改java版本
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>