我是一个新的“mavenist”... :-)在eclipse maven项目中设置jdk版本
我使用Eclipse Mars。
我创建了一个默认的maven项目,默认情况下它使用JDK 1.5。 我想用1.8.31代替。
我现在的POM显示以下内容:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
On apache maven website我读,我需要改变\它替换到这样的事情:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable><!-- path-to-javac --></executable>
<compilerVersion>1.8.31</compilerVersion>
</configuration>
</plugin>
- 这是正确的代码,把?
- 它应该替换当前的代码,还是应该将其添加到xml?
谢谢!
你可以有 在 和 –