Open QuantumBear opened 7 years ago
@QuantumBear having the same problem here, did you find a solution?
Looks like this issue is from using a rather outdated version of scrooge. Try using the same version of scrooge-core as you're using with the plugin.
run command 'mvn clean install' with latest trunk code.
[ERROR] /home/sili/code/scrooge/demos/scrooge-maven-demo/src/main/scala/com/twitter/example/Demo.scala:14: error: overloaded method value hosts with alternatives:
[ERROR] (address: java.net.InetSocketAddress)com.twitter.finagle.builder.ClientBuilder[Nothing,Nothing,com.twitter.finagle.builder.ClientConfig.Yes,Nothing,Nothing]
@QuantumBear yeah that looks like a bug.
and worse, it looks like we have nothing in the way of tests (or even compilation!) for the demos.
it probably wouldn't be too hard to fix based on a quick look around in that folder.
@QuantumBear I'm going to take a stab at this. In the long run, we should have a travisci job which will fail if the demos don't build. Would you be interested in making a PR for that?
I just ran into the same issue on Scrooge 18.5.0
with libthrift
0.10.0
, which is the default version included with that version of Scrooge. I played around with different versions of libthrift, but no dice.
Are there any workarounds for the issue?
@gregsilin sorry for not getting back to you for a while. just to confirm, the issue you're seeing is with the scrooge demos?
I ran into that just now when the maven (or sbt in my case) and the lib versions aren't aligned. Especially recently moving things from .scrooge to .finagle.thrift threw me off because I updated the lib but not the plugin:
object ThriftService is not a member of package com.twitter.scrooge
I don't know if this is the exact same as the — now quite old — original issue, but it seems something to verify, as generator & code versions not matching produce these weird "class no found" errors.
I had the same problem and solved it by updating the sbt-scrooge-plugin in project/plugins.sbt
like so:
addSbtPlugin("com.twitter" %% "scrooge-sbt-plugin" % "19.1.0")
and adding these dependencies in build.sbt
:
"com.github.finagle" %% "finch-core" % "0.27.0",
"com.twitter" %% "finagle-thrift" % "19.1.0",
"com.twitter" %% "util-core" % "19.1.0",
"com.twitter" %% "scrooge-core" % "19.1.0"
As you can see I'm using Finagle. Hope it helps.
I try to use scrooge to compile thrift files to Scala files, but get lots of compile errors even I use the code in demos/scrooge-maven-demo.
Expected behavior
Build success with mvn clean install command.
Actual behavior
Get lots of compile erros
Here is error log when I compile scrooge-maven-demo.
[ERROR] /home/sili/code/scrooge/demos/scrooge-maven-demo/target/generated-sources/thrift/scrooge/com/twitter/mydemo/renamed/UserService.scala:9: error: object HasThriftStructCodec3 is not a member of package com.twitter.scrooge [ERROR] import com.twitter.scrooge.{ [ERROR] ^ [ERROR] /home/sili/code/scrooge/demos/scrooge-maven-demo/target/generated-sources/thrift/scrooge/com/twitter/mydemo/renamed/User.scala:9: error: object HasThriftStructCodec3 is not a member of package com.twitter.scrooge [ERROR] import com.twitter.scrooge.{ [ERROR] ^ [ERROR] /home/sili/code/scrooge/demos/scrooge-maven-demo/target/generated-sources/thrift/scrooge/com/twitter/mydemo/renamed/User.scala:353: error: not found: type HasThriftStructCodec3 [ERROR] with HasThriftStructCodec3[User] [ERROR] ^ [ERROR] /home/sili/code/scrooge/demos/scrooge-maven-demo/src/main/scala/com/twitter/example/Demo.scala:37: error: overloaded method value stack with alternatives: [ERROR] [Req1, Rep1](server: com.twitter.finagle.server.StackBasedServer[Req1,Rep1])com.twitter.finagle.builder.ServerBuilder[Req1,Rep1,com.twitter.finagle.builder.ServerConfig.Yes,Nothing,Nothing]
[ERROR] [Req1, Rep1](mk: com.twitter.finagle.Stack.Params => com.twitter.finagle.Server[Req1,Rep1])com.twitter.finagle.builder.ServerBuilder[Req1,Rep1,com.twitter.finagle.builder.ServerConfig.Yes,Nothing,Nothing]
And here is the error log when compile my project.
[ERROR] /home/sili/workspace/new-sessionlog-proto/target/generated-sources/thrift/scrooge/com/mediav/data/log/unitedlog/ShowInfo.scala:9: object HasThriftStructCodec3 is not a member of package com.twitter.scrooge [ERROR] import com.twitter.scrooge.{ [ERROR] ^ [ERROR] /home/sili/workspace/new-sessionlog-proto/target/generated-sources/thrift/scrooge/com/mediav/data/log/unitedlog/ShowInfo.scala:3045: not found: type HasThriftStructCodec3 [ERROR] with HasThriftStructCodec3[ShowInfo] [ERROR] ^ [ERROR] /home/sili/workspace/new-sessionlog-proto/src/main/scala/com/mvad/sessionlog/newSessionlog.scala:32: value isSetFraudInfo is not a member of com.mediav.data.log.unitedlog.ShowInfo [ERROR] if (showInfo.isSetFraudInfo [ERROR] ^ [ERROR] /home/sili/workspace/new-sessionlog-proto/target/generated-sources/thrift/scrooge/com/mediav/data/log/unitedlog/FraudInfo.scala:9: object HasThriftStructCodec3 is not a member of package com.twitter.scrooge [ERROR] import com.twitter.scrooge.{ [ERROR] ^ [ERROR] /home/sili/workspace/new-sessionlog-proto/target/generated-sources/thrift/scrooge/com/mediav/data/log/unitedlog/FraudInfo.scala:569: not found: type HasThriftStructCodec3 [ERROR] with HasThriftStructCodec3[FraudInfo] [ERROR] ^ [ERROR] /home/sili/workspace/new-sessionlog-proto/src/main/scala/com/mvad/sessionlog/newSessionlog.scala:34: value fraudReasons is not a member of Option[com.mediav.data.log.unitedlog.FraudInfo] [ERROR] showInfo.fraudInfo.fraudReasons.mkString(",") [ERROR] ^ [ERROR] /home/sili/workspace/new-sessionlog-proto/target/generated-sources/thrift/scrooge/com/mediav/data/log/unitedlog/UnitedEvent.scala:9: object HasThriftStructCodec3 is not a member of package com.twitter.scrooge [ERROR] import com.twitter.scrooge.{ [ERROR] ^ [ERROR] /home/sili/workspace/new-sessionlog-proto/target/generated-sources/thrift/scrooge/com/mediav/data/log/unitedlog/UnitedEvent.scala:1096: not found: type HasThriftStructCodec3 [ERROR] with HasThriftStructCodec3[UnitedEvent] [ERROR] ^ [ERROR] /home/sili/workspace/new-sessionlog-proto/src/main/scala/com/mvad/sessionlog/newSessionlog.scala:44: trait UnitedEvent is abstract; cannot be instantiated [ERROR] Try(ThriftUtils.detectAndDeserialize(ueBytes, new UnitedEvent())) match { [ERROR] ^ [ERROR] /home/sili/workspace/new-sessionlog-proto/src/main/scala/com/mvad/sessionlog/newSessionlog.scala:45: too many arguments for method apply: (x: A)Some[A] in object Some [ERROR] case Success(ue) => Some(ue.getEventType.
type
,ue) [ERROR] ^ [ERROR] /home/sili/workspace/new-sessionlog-proto/target/generated-sources/thrift/scrooge/com/mediav/data/log/unitedlog/AdSlotClickInfo.scala:9: object HasThriftStructCodec3 is not a member of package com.twitter.scrooge [ERROR] import com.twitter.scrooge.{ [ERROR] ^ [ERROR] /home/sili/workspace/new-sessionlog-proto/target/generated-sources/thrift/scrooge/com/mediav/data/log/unitedlog/AdSlotClickInfo.scala:363: not found: type HasThriftStructCodec3 [ERROR] with HasThriftStructCodec3[AdSlotClickInfo] [ERROR] ^Steps to reproduce the behavior
Add this configuration to my pom.xml then run mvn clean install
Add this plugin configuration.