I'm a rookie developer trying to run an application using play framework. I've followed the tutorial and can successfully create a new project.
However when I go to the directory that has the project I'm supposed to work on and enter the play command I get the following error:
[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: clean)
[error] play
I have very little knowledge regarding the framework and don't know where to start correcting my mistake. Any suggestions ?
To run the tutorial: Unzip the project in a convenient location. In a command window, change to the top-level project directory. Enter sbt run .
You then need to import the application into your Workspace with the File/Import/General/Existing project… menu (compile your project first). To debug, start your application with sbt -jvm-debug 9999 run and in Eclipse right-click on the project and select Debug As, Debug Configurations.
“Typesafe Activator is a browser-based or command-line tool that helps developers get started with the Typesafe Reactive Platform.”
You have to run the play command this way:
./play cmd [app_path] [--options]
where in case of running a project, it is
./play run /path/to/projectname
I am facing this problem in the context of sub projects.
This is what worked for me.
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)
}
On running 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] ^
Solution:
Now, if I rename helloWorldProj
as zhelloWorldProj
, it works!
In this case, play
sets the active project to WebApp
.(Since webAppProj
variable name alphabetically comes before zhelloWorldProj
)
I can then change the active project to HelloWorld
by giving the command project HelloWorld
.
I think this has something to do with how sbt
finds the Project objects using reflection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With