suleydaman
suleydaman

Reputation: 473

SBT: Invalid project ID: Expected ID character when pointing to module in subdirectory

I a multi-module project structured like this

+- multiModuleProject
  +-module1

  +-dir1
    +-subDirModule1
    +-subDirModule2

  +-module3

  +-build.sbt

I want both subDirModule1 and subDirModule2 to be their own modules outright.

I added something like this to the build.sbt

lazy val subDir1 = Project(id = "dir1/subDirModule1", base = file("dir1/subDirModule1")
lazy val subDir1 = Project(id = "dir1/subDirModule2", base = file("dir1/subDirModule2")

I can't get it to work, I keep getting

[error] java.lang.RuntimeException: Invalid project ID: Expected ID character
[error] dir1/subDirModule1
[error]     ^

But I'm sure I've seen a slash being used in another project I've worked on. What going wrong here?

Upvotes: 0

Views: 3419

Answers (1)

Alexey Romanov
Alexey Romanov

Reputation: 170713

Slash is used as a separator between project ID and config and has been for a long time, so I suspect you are misremembering (if you don't, you'd need to escape it all the time and I at least never remember seeing it). You can of course use it in the path (base argument), just not in the ID:

lazy val subDir1 = Project(id = "subDir1", base = file("dir1/subDirModule1"))

and then use e.g.

sbt> subDir1/compile

You can of course use whatever name you want, but usually the val name and the id will be the same.

Upvotes: 1

Related Questions