question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error: recursive value needs type

See original GitHub issue

I have a multi-project build where I have three projects defined: interface, client and service (root project):

lazy val interface = (project in file("interface"))
  .settings(...)

lazy val client = (project in file("client"))
  .dependsOn(interface, service % "test->test")
  .settings(...)

lazy val service = (project in file("."))
  .dependsOn(interface)
  .settings(...)

As you can see, client and service both depend on interface, and client test scope also depends on service test scope. This works fine. However, I would like service, as the root project, to also aggregate the client project – however, if I add this line to the service config:

.aggregate(client)

I get the following error in the client project definition:

/Users/kflorence/dev/mosaic/utility-service/build.sbt:42: error: recursive value service needs type
  .dependsOn(interface, service % "test->test")

Is there any way to make this work?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:3
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
eed3si9ncommented, Sep 10, 2015

Related #2104 and #2183. This is because aggregate doesn’t take the by-name parameter. You could try working around this issue by creating a Ref value:

lazy val interface = (project in file("interface"))

lazy val client = (project in file("client"))
  .dependsOn(interface, service % "test->test")
lazy val clientRef = LocalProject("client")

lazy val service = (project in file("."))
  .aggregate(clientRef)
  .dependsOn(interface)
2reactions
dwijnandcommented, Jan 22, 2018

Yeah you need to either provide the type or use a project reference like LocalProject.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Recursive value xxx needs type in Scala - Stack Overflow
I have two classes which depend on each other. When I try to create a new instance of A without a type declaration,...
Read more >
Recursive value needs type - Question - Scala Users
I don't understand the compiler error that says the recursive value mt needs type. Is mt really a recursive value? Here's the error....
Read more >
Fixing scala error “error: recursive value count needs type”
The reason for this is that the type inference algorithm isn't set up to handle this – while this is a simple example,...
Read more >
Unexpected "recursive value needs type" error #5091 - GitHub
So my recursive value x needs type is different from bug's recursive value needs type ? Sorry if it is a different bug,...
Read more >
recursive value count needs type - Cumulative Sum
The fix is really simple, just don't name the new variable as count it conflicts with count function. Let's name it count2: scala>...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found