-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not compile scrooge generated code #254
Comments
@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: |
@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? |
Problem The maven demos are broken, cf #254 Solution Fix 'em and update the libraries and plugin. RB_ID=916328
I just ran into the same issue on Scrooge 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:
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
and adding these dependencies in
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.
The text was updated successfully, but these errors were encountered: