How to lookup Maven Artifacts corresponding to Undefined Akka-Scala Classes

86 views
Skip to first unread message

Dagny T

unread,
Aug 30, 2016, 7:34:35 PM8/30/16
to Akka User List

I'm trying to find the build.sbt dependencies for testing Akka-Scala APIs.

Would anyone be able to tell me the details for a reliable way in general to track down corresponding Maven Artifacts for undefined symbols with Scala and Akka?

Thus far, I've just been copying build.sbts from pre-built examples; but now the examples I'm looking at are incomplete with respect to providing those build.sbt dependencies.

Specifically, I'm looking at a WebSockets Server with Scala Test and Akka Testkit where the following Symbols are not found:
- WS
- RoutingSpec
handleWebSocketMessages
- shouldEqual

I've already tried the following in my build.sbt file:
"com.typesafe.akka" %% "akka-stream" % "2.4.9",
"com.typesafe.akka" %% "akka-http-core" % "2.4.9",
"com.typesafe.akka" %% "akka-http-testkit" % "2.4.9",
"com.typesafe.akka" %% "akka-stream-testkit" % "2.4.9",
// TODO: find out if below is still needed for routing DSL
"com.typesafe.akka" %% "akka-http-experimental" % "2.4.9",
"org.scalatest" %% "scalatest" % "3.0.0-SNAP13" % "test",

Jason Steenstra-Pickens

unread,
Aug 30, 2016, 9:57:15 PM8/30/16
to Akka User List
Hard to say exactly what you need without more information.

What are you trying to compile? Do you know the fully qualified names for these symbols?

Some guesses:
  • WS - Not sure what this is, perhaps it was a renamed import?
  • RoutingSpec - This sounds like test class, probably not something you are going to find in Akka.
  • handleWebSocketMessages - This is defined in akka.http.scaladsl.server.directives.WebSocketDirectives. I think this is part of the Routing DSL. Akka Docs Overview says to import "akka-http-experimental" which you already have. Have you read Routing DSL Overview? This says you need to import:
    import akka.http.scaladsl.server.Directives._
  • shouldEqual - This is part of the ScalaTest Matchers DSL. Did you mix in the Matchers trait to your test class?

FYI: You can always search these things either on GitHub (https://github.com/akka/akka) or in the ScalaDoc (http://doc.akka.io/api/akka/2.4.9). Tip: Use the letters up the top right to find functions.

Perhaps you can give more information on how you are using these other Symbols to provide some clues to what they could be.


Cheers,
Jason

Jason Steenstra-Pickens

unread,
Aug 30, 2016, 10:01:27 PM8/30/16
to Akka User List
Actually I did find RoutingSpec (https://github.com/akka/akka/search?utf8=%E2%9C%93&q=RoutingSpec) although it doesn't appear in the public docs. Perhaps what you really wanted was ScalatestRouteTest?

Dagny T

unread,
Aug 31, 2016, 2:01:55 AM8/31/16
to Akka User List

Hi Jason,

Thanks for looking into this!

1) The code I'm trying to build is this:

2) The WebSocket implementation builds for me; with minor tweaks on Import statements; 
and I pretty much used the IntelliJ IDE Shortcuts to find and fix all of those for me!

3) The Testing code does not build for me; on separating it into its own Runnable class.   This is with the latest Akka v2.4.9 libraries in my build.sbt which I had posted earlier.

4) I had already searched the Akka GitHub repos for the original Test example Code, and found it; but then  could not find a (focused, specific) build.sbt that works specifically for the WebSocket Test code in that example.

5) IntelliJ fails to 'suggest' fixes for those unresolved types I'd mentioned (and yes; you'll see that WS is one of those types in the example code).

So 'perhaps' the example code then is not in Sync with the latest Akka v2.4.9 Libraries?  OR, I've got my IDE configured incorrectly to pickup the wrong dependencies.

6) When working with Java and Maven in the past; had also found a public site that helped map Class names to its respective Maven Dependency library.
Would be FABULOUS to find a similar site for Scala/Akka to lookup libraries needed to Download; and for a specific Scala class name!!

Thanks!
D

Dagny T

unread,
Aug 31, 2016, 1:42:44 PM8/31/16
to Akka User List

So, here's what I've found out so far; and could use help to conclude:

A) The complete code from the Documentation code I was looking at is here:

B) The undefined classes for WS(...) and RoutingSpec(...) are not documented when I enter the names in the SearchBox for Akka 2.4.9 Documentation:

C) I've just been guessing at the correct build.sbt dependencies; because I'm not able to find a focused one for the Websocket Server sample code on GitHub

D) IntelliJ IDE apparently cannot detect the presence of WS and RoutingSpec classes within the akka 2.4.9 dependencies listed in my build.sbt.

SO, not clear on if the Sample Code is using some stale version of the Akka dependencies!

On Tuesday, August 30, 2016 at 4:34:35 PM UTC-7, Dagny T wrote:

Jason Steenstra-Pickens

unread,
Sep 4, 2016, 7:52:26 PM9/4/16
to Akka User List
WS is actually a function from WSTestRequestBuilding, not a type.

Looking at http://doc.akka.io/docs/akka/2.4.9/scala/http/routing-dsl/testkit.html#route-testkit you probably just need to mixin ScalatestRouteTest to your test.
Reply all
Reply to author
Forward
0 new messages