/ / Nie można skompilować źródła wygenerowanego przez wtyczkę oszczędnościową scrooge - scala, protokół oszczędzania, scrooge

Nie można skompilować źródła wygenerowanego przez wtyczkę oszczędnościową scrooge - scala, protokół oszczędzania, scrooge

Moja wtyczka.sbt jest

addSbtPlugin("com.twitter" % "scrooge-sbt-plugin" % "4.8.0")

Mój build.sbt jest

val finagleVersion = "6.45.0"

lazy val myProject = Project("FinagleTest", file("."))
.settings(
name := "FinagleTest",
version := "1.0",
scalaVersion := "2.12.2",
libraryDependencies ++= Seq(
"org.apache.thrift" % "libthrift" % "0.9.2",
"com.twitter" %% "scrooge-core" % "4.18.0" exclude("com.twitter", "libthrift"),
"com.twitter" %% "finagle-thrift" % finagleVersion exclude("com.twitter", "libthrift"),
"com.twitter" %% "finagle-http" % finagleVersion,
"com.twitter" %% "finagle-core" % finagleVersion
),
scroogeThriftSourceFolder in Compile := {
val base = baseDirectory.value
base / "src/main/thrift"
}
)

Utworzono plik temprature_service.thrift w src/main/thrift teczka

namespace * com.foo.temprature.thrift
struct TempratureDatum {
1: i32 celcius,
2: i64 timestamp
}

service TempratureService {
void add(1: TempratureDatum datum);
double mean();
}

i skompilowane przy użyciu sbt clean scrooge-gen compile

ale dostaję błędy kompilacji

[info] Compiling 5 Scala sources to /Users/Foo/IdeaProjects/FinagleTest/target/scala-2.12/classes...
[error] /Users/Foo/IdeaProjects/FinagleTest/target/scala-2.12/src_managed/main/com/foo/temprature/thrift/TempratureDatum.scala:481: value _equals is not a member of object scala.runtime.ScalaRunTime
[error]       _root_.scala.runtime.ScalaRunTime._equals(this, other) &&
[error]                                         ^
[error] /Users/Foo/IdeaProjects/FinagleTest/target/scala-2.12/src_managed/main/com/foo/temprature/thrift/TempratureService.scala:65: type mismatch;
[error]  found   : com.twitter.finagle.Service[com.foo.temprature.thrift.TempratureService.Add.Args,com.foo.temprature.thrift.TempratureService.Add.SuccessType]
[error]     (which expands to)  com.twitter.finagle.Service[com.foo.temprature.thrift.TempratureService.Add.Args,Unit]
[error]  required: com.twitter.finagle.Service[com.foo.temprature.thrift.TempratureService.Add.Args,com.foo.temprature.thrift.TempratureService.Add.Result]
[error]           add = ThriftServiceIface(self.Add, binaryService, pf, stats),
[error]                                   ^
[error] /Users/Foo/IdeaProjects/FinagleTest/target/scala-2.12/src_managed/main/com/foo/temprature/thrift/TempratureService.scala:66: type mismatch;
[error]  found   : com.twitter.finagle.Service[com.foo.temprature.thrift.TempratureService.Mean.Args,com.foo.temprature.thrift.TempratureService.Mean.SuccessType]
[error]     (which expands to)  com.twitter.finagle.Service[com.foo.temprature.thrift.TempratureService.Mean.Args,Double]
[error]  required: com.twitter.finagle.Service[com.foo.temprature.thrift.TempratureService.Mean.Args,com.foo.temprature.thrift.TempratureService.Mean.Result]
[error]           mean = ThriftServiceIface(self.Mean, binaryService, pf, stats)
[error]                                    ^
[error] /Users/Foo/IdeaProjects/FinagleTest/target/scala-2.12/src_managed/main/com/foo/temprature/thrift/TempratureService.scala:248: value _equals is not a member of object scala.runtime.ScalaRunTime
[error]           _root_.scala.runtime.ScalaRunTime._equals(this, other) &&
[error]                                             ^
[error] /Users/Foo/IdeaProjects/FinagleTest/target/scala-2.12/src_managed/main/com/foo/temprature/thrift/TempratureService.scala:373: value _equals is not a member of object scala.runtime.ScalaRunTime
[error]           _root_.scala.runtime.ScalaRunTime._equals(this, other) &&
[error]                                             ^
[error] /Users/Foo/IdeaProjects/FinagleTest/target/scala-2.12/src_managed/main/com/foo/temprature/thrift/TempratureService.scala:524: value _equals is not a member of object scala.runtime.ScalaRunTime
[error]           _root_.scala.runtime.ScalaRunTime._equals(this, other) &&
[error]                                             ^
[error] /Users/Foo/IdeaProjects/FinagleTest/target/scala-2.12/src_managed/main/com/foo/temprature/thrift/TempratureService.scala:705: value _equals is not a member of object scala.runtime.ScalaRunTime
[error]           _root_.scala.runtime.ScalaRunTime._equals(this, other) &&
[error]                                             ^
[error] 7 errors found

Odpowiedzi:

0 dla odpowiedzi № 1

Zabawne dzisiaj pisałem kolejną usługę oszczędnościową i znalazłem ten problem, który został wysłany przeze mnie 1 rok wstecz :)

Na szczęście rozwiązanie jest dość łatwe.

Wersja wtyczki użyta w powyższym kodzie jest bardzo stara.

Możesz znaleźć najnowszą wersję tej wtyczki tutaj

https://bintray.com/twittercsl/sbt-plugins/scrooge-sbt-plugin

Problem zostanie rozwiązany, jeśli zaktualizuję plik plugins.sbt do

addSbtPlugin("com.twitter" % "scrooge-sbt-plugin" % "18.4.0")