接口中的静态方法需要-target:jvm-1.8 [英] Static methods in interface require -target:jvm-1.8

查看:69
本文介绍了接口中的静态方法需要-target:jvm-1.8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用gradle 4.5,带有JDK 1.8.0_162的scala 2.11.11/2.12.4构建scala项目,并且在我升级到scala 2.11.12之前,它运行良好.使用2.11.12时,我会不断出现编译错误

I'm building scala project using gradle 4.5, scala 2.11.11/2.12.4 with JDK 1.8.0_162 and it was working fine until I upgrade to scala 2.11.12. With 2.11.12 I keep getting compile error

Static methods in interface require -target:jvm-1.8

我一直在尝试在Google中搜索并添加诸如此类的东西

I've been trying to search in google and add couple of stuffs like

ScalaCompileOptions.metaClass.useAnt = false

targetCompatibility="1.8"

但他们都无法解决问题.

but none of them fix the issue.

推荐答案

好吧,在为这个问题苦苦挣扎了几周并决定在SO上发表文章之后,我尝试用gradle进一步摆弄,终于解决了问题.

Ok, after struggling with this problem for a few weeks and decided to post on SO, I try to fiddle further more with gradle, I finally managed to fix this problem.

结果是我必须将这两行添加到gradle中

Turns out that I have to add these two lines to gradle

project.tasks.compileScala.scalaCompileOptions.additionalParameters = ["-target:jvm-1.8"]project.tasks.compileTestScala.scalaCompileOptions.additionalParameters = ["-target:jvm-1.8"]

project.tasks.compileScala.scalaCompileOptions.additionalParameters = ["-target:jvm-1.8"] project.tasks.compileTestScala.scalaCompileOptions.additionalParameters = ["-target:jvm-1.8"]

这可以解决问题,并且不会再次出现.

This is fixing the issue and it doesn't come back.

这篇关于接口中的静态方法需要-target:jvm-1.8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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