maven :(使用-source 5或更高版本来启用静态导入声明) [英] maven: (use -source 5 or higher to enable static import declarations)

查看:104
本文介绍了maven :(使用-source 5或更高版本来启用静态导入声明)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用源5?
我试过

How can I use source 5? I tried

mvn -source 5 test

但它不起作用: - )

but it didn't work :-)

当我用javac编译文件时,一切正常。

When I compile the file by javac, everything works.

推荐答案

您需要配置 maven-compiler-plugin

You need to configure the 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>

编辑:更改示例以使用最新版本的插件。

Changed example to use latest version of the plugin.

这篇关于maven :(使用-source 5或更高版本来启用静态导入声明)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆