I ran into this problem in the context of subprojects.
This is what worked for me.
The code:
import sbt._ import sbt.Keys._ object ApplicationBuild extends Build { val helloWorldProj = Project(id = "HelloWorld", base = file("helloworld")) val appName = "WebApp" val appVersion = "1.0" val appDependencies = Seq() val webAppProj = PlayProject( appName, appVersion, appDependencies, path = file("webapp"), mainLang = PlayProject.SCALA) .dependsOn(helloWorldProj) .aggregate(helloWorldProj) }
When I run the play
command, I get the following error:
Error:
[info] Set current project to HelloWorld (in build file:/D:/EclipseProjects/HelloWorldPlayMultiProject/) [error] Not a valid command: play (similar: last, alias, loadp) [error] Not a valid project ID: play [error] Not a valid configuration: play [error] Not a valid key: play (similar: play-hash, play-dist, play-conf) [error] play [error] ^
Decision:
Now, if I rename helloWorldProj
as zhelloWorldProj
, it will work! In this case, play
installs the active project on WebApp
. (Since webAppProj
the variable name is alphabetically preceded by zhelloWorldProj
)
Then I can change the active project to HelloWorld
by specifying the project HelloWorld
.
I think this has something to do with how sbt
finds Project objects using reflection.
source share