如何使用源 5? 我试过了
mvn -source 5 test
但它没有工作:-)
当我通过 javac 编译文件时,一切正常。
最佳答案
您需要配置maven-compiler-plugin
:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
...
</plugins>
...
</build>
</project>
编辑:更改示例以使用最新版本的插件。
关于java - 行家: (use -source 5 or higher to enable static import declarations),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2451268/