Play framework cannot start an existing project

I am a beginner developer trying to run an application using a playback platform. I followed the tutorial and can successfully create a new project.

However, when I go to the directory in which there is a project that I have 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 about the structure and do not know where to start correcting my error. Any suggestions?

+6
source share
7 answers

The problem was the difference in the version of the game. The project I was working on was developed in game 1.2, where I installed version 2.0.

By the way, working with 2.0 on a project developed by version 1.2 is possible, but I highly recommend not doing it this way, since there are problems at later stages.

0
source

You should run the play command as follows:

 ./play cmd [app_path] [--options] 

where in case of project start it

 ./play run /path/to/projectname 
+3
source

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.

+2
source

You need to have more detailed information about your environment (OS, Play version, etc.), but if you get errors that play, then this is not a valid command, my first course of action is to check that the path to play.sh ( I suppose you use non-windows) is included in your system path?

+1
source

I delete all directories in the project folder and it works. Do not delete files (build.properties, Build.scala and plugins.sbt)

+1
source

Depending on the language you are using, make sure that the build.sbt file contains one of the following files:
play.Project.playJavaSettings
play.Project.playScalaSettings

0
source

I have the same problem too! What happened was in the / user / xxx / project folder, there were old projects from version 1.x. Removing this folder worked for me!

0
source

Source: https://habr.com/ru/post/912110/


All Articles