I wrote the following code:
import software.amazon.awssdk.services.cloudwatchlogs.CloudWatchLogsClient
class Test() extends CloudWatchLogsClient {
CloudWatchLogsClient.builder().build()
def close():Unit = {
println("test")
}
def serviceName(): String = "serviceName"
CloudWatchLogsClient.create()
}
When it comes to compiling , I get the following error:
Static methods in interface require -target:jvm-1.8
CloudWatchLogsClient.builder().build()
Finally, I used the following dependencies in my build.sbt file
libraryDependencies += "software.amazon.awssdk" % "cloudwatch" % "2.15.40",
libraryDependencies += "software.amazon.awssdk" % "cloudwatchlogs" % "2.15.40"
Java version is 1.8, and Scala version is 2.11.12. Any idea, how to fix this please?
Please add the following into your build.sbt
:
scalacOptions in ThisBuild += "-target:jvm-1.8"
There is a similar question asking about the same error at Gradle at Static methods in interface require -target:jvm-1.8.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With