Advice On Using Scala & SBT?

Hi. I’m starting a new project with Akka Serverless and am finding the lack of documentation and support for Scala and SBT challenging. So, before I go investing too much time in that direction, I’d like to ask some fundamental questions that hopefully will steer me in the right direction.

  1. Is there something fundamental in the AS Java API that means I can’t get an AS project written in Scala working via the Java API despite the language compatibility?
  2. I have not found a way to avoid this import error:
    gateway.proto:8:1: Import "akkaserverless/annotations.proto" was not found or had errors. despite including this library dependency in SBT: "com.akkaserverless" % "akkaserverless-sdk-protocol" % "0.7.0-beta.14" % "protobuf" Is there a proper way to get the akkaserverless protocol buffers declarations unpacked?
  3. Is there an ongoing effort to support an sbt plugin for akka serverless? If so, I would like to join that effort and accelerate it.

Hi @reid-spencer!

  1. We’re working on a Scala SDK for Akka Serverless, in the mean time you can definitely use the Java SDK within your Scala apps. If you’re facing any issues with that, please open a support request so we can help you.
  2. You should be able to use sbt with the Akka Serverless annotations. Can you try adding
"com.akkaserverless" % "akkaserverless-sdk-protocol" % "0.7.0-beta.14" % "protobuf-src"
  1. We haven’t started it yet, but we’d definitely appreciate your help.
1 Like

Thank you Leon for the quick response!

This is definitely encouraging and I will report back if the “protobuf-src” provides access to the annotations.


Using “protobuf-src” did not immediately help, but there’s probably more going on in my sbt build. I’ve just discovered the github repo for the javasdk so I’m going to look at how it does things and learn.

Would it be helpful if I started working on an sbt-akkaserverless project to encapsulate my learning on how to make things work from Scala/SBT ?

Hi @reid-spencer,

I’ll also check with some of the engineers to see what potential issues might be.

If you would create an sbt-akkaserverless project that would be amazing. It’ll help get to the bottom of this issue and will also help influence our thinking around the Scala SDK.

For the akkaserverless annotations, you will need akkaserverless-sdk-protocol as a protobuf or protobuf-src dependency. This is a transitive dependency for the Java SDK. I think there are also some Google protobuf definitions that need to be included, and these should be bundled into the Java SDK jar. So it should work with in sbt (using sbt-protoc) with the SDK dependency also scoped for protobuf:

"com.akkaserverless" % "akkaserverless-java-sdk" % "0.7.0-beta.18" % "compile;protobuf"

And that will also include the SDK protocol with the akkaserverless annotations.

I’ve created a port of the simple Counter sample (created when using the Java Maven archetype) over to Scala and sbt.

I haven’t added tests or a docker build yet, but it shows the basics of using sbt for the build and using the Java SDK from Scala.

1 Like

Thank you, Peter.
I created a repo for sbt-akkaserverless today, here:

I’m still working on establishing a baseline/working commit but hope to get it there by this weekend.

FYI: The first, bare-bones, commit/push is done. It passes a minimal test. Many more details need to be flushed out and tested. Opinions on it are welcome!


Cool, looking good!

For an official sbt plugin, I’m not sure if we would include all of those plugin dependencies automatically — dynver, buildinfo, scalafmt — even if they’re becoming fairly standard. Certainly built-in integration for Protobuf / Akka gRPC and the Docker build will be good.

Yeah, those others are a habit, by release time I’ll have it pared down.

I’ve recently gotten version 0.1.6 to work with a project.
I’m now trying to get AkkaGrpc 2.1.0 integrated.

Akka GRPC 2.1.0 is integrated into release 0.1.7

Up next: getting it published to maven central

1 Like

We’ve run into what we believe is a roadblock. I created sbt-akkaserverless under the belief that akka-grpc would do the necessary code generation. It looks like this is not true. Based on the 0.7.0 release of akka serverless, and its documentation, it looks like there are supposed to be classes named “AbstractXXX” from which implementation should derive. That doesn’t happen with akka-grpc when generating Scala code. So:

  • Are there any options we need to pass to akka-grpc to get it to generate the classes that akka serverless needs?
  • Is this simply a difference in Java code generation versus Scala code generation?
  • Is the documentation for 0.7.0 actually up to date? (i.e. it suggests to derive from AbstractXXX classes but perhaps that’s the old way?)
  • Does Akka Serverless have its own protoc compiler plugin to generate code?

Yes, Akka Serverless has its own code generation.

The Scala SDK, including code generation and sbt plugin, have been started now. You can follow this in the Java SDK repo:

Hey there! Just wanted to share the a new Scala SDK has landed for Akka Serverless…you can simply toggle the language setting at the top of the page here, and you’ll be good to go! Developing with Java or Scala :: Akka Serverless Documentation