play command doesn't work when inside of an existing sbt project - scala

So I have an existing sbt project setup:
common
services
project/build.scala
build.sbt
Now when inside this folder, I want to create a play application called 'web'.
I get this error:
error] Not a valid command: new (similar: set)
[error] Not a valid project ID: new
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: new (similar: name, run, runner)
[error] new
[error] ^
The play command works just fine if I try the same thing in a new folder.
How can I get the play command to work inside of an existing sbt project?
I'm using sbt .13

Why not create the project outside of the current structure, then move the created directory where you want it to live?

Related

Trying to use Play Framework

Not sure how to describe this error, but I'll try. I'm trying to learn to use the Play Framework for a project I'm collaborating on, and a few hours into but having trouble.
After creating a new project with activator, entering the directory and then typing activator, I then type "play" and get this output:
➜ ix activator
[info] Loading project definition from /Users/ace/Projects/ix/project
[info] Updating {file:/Users/ace/Projects/ix/project/}ix-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to ix (in build file:/Users/ace/Projects/ix/)
[ix] $ play
[error] Not a valid command: play (similar: apply, last, alias)
[error] Not a valid project ID: play
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: play (similar: playStop, playConf, play-stop)
[error] play
[error]
I can't make any sense of it. Literally just installed everything today (Scala/Play Framework) and using it on OSX 10.10.
You have to use the "activator" command instead of "play". This has been the case since version 2.3:
The first thing you’ll notice about Play 2.3 is that the play command
has become the activator command. Play has been updated to use
Activator...

"dist" command gets "not a valid command" error

I have a working Play Framework 2.1 application generated with typesafe activator that I've developed in Scala. I'm trying to deploy it in CloudBees using the instructions that can be found here: http://wiki.cloudbees.com/bin/view/RUN/Playframework#HDeployingaPlay2application using the method described under "Using Cloudbees SDK."
However, when I load up the play console and try to run the "dist" command, I get the error "Not a valid command: dist."
I've tried two run this three different ways:
In the terminal window (I'm using Mac OS X), I navigated to the project directory, ran the "activator" application (there is no application in that directory called "play", but "activator" seems to be the), then from the prompt that appears I enter the command "dist."
I downloaded the regular (non-activator) Play Framework distirbution file, add the directory to my path using "export PATH=$PATH:/Applications/play-2.2.2", navigated to the project directory, and ran the command "play dist."
Installed play using Homebrew. Navigated to the project directory and ran "play dist".
All three methods give me the same error (see below). Is the method different for my version of play? Am I missing something from the sbt file? How can I get this working?
Full output for "play dist":
Macmini-##########-#:nimrandslibrary.searchfu.esl kpyancey$ play dist
[info] Loading project definition from /Users/kpyancey/Projects/NimrandsLibrary.SearchFu.Esl/project
[info] Set current project to NimrandsLibrary.SearchFu.Esl (in build file:/Users/kpyancey/Projects/NimrandsLibrary.SearchFu.Esl/)
[error] Not a valid command: dist (similar: set, iflast, last)
[error] Not a valid project ID: dist
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: dist (similar: test, ivy-sbt, history)
[error] dist
[error] ^
I think you have misconfigured something in your project.
To double check, generate a new project from Activator or try downloading https://github.com/CloudBees-community/play2-clickstart (which is correctly configured) and run play dist.

Not a valid command: it when executing sbt it

I followed the steps for adding integration tests found at http://www.scala-sbt.org/release/docs/Detailed-Topics/Testing#integration-tests.
However, when I run sbt it, see the following:
$ sbt it
[info] Loading project definition from myproj/project
[info] Set current project to myproj (in build file:myproj/)
[error] Not a valid command: it
[error] Not a valid project ID: it
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: it
[error] it
[error] ^
sbt test works as expected
What's described in Integration Tests is about how to add a new configuration, namely it. There are many configurations available, e.g. Compile, Test, Runtime, Docs, Pom - you can find the default ones as vals in the sbt.Configuration object.
The official documentation of SBT in Selecting the configuration and Scoping by configuration axis should explain why you calling sbt it would require a command or a task with the it name which as it turned out was not the case.
The it configuration binds tasks that you may have used in the other configurations like test be reconfigured so the integration tests are in it directory (rather than in their default one - src/test).
After a bunch of googling, I realized the problem was that integration tests aren't quite the same as tests. To run integration tests, the configuration is slightly different:
sbt it:test
When I do that, everything works fine.

Just downloaded the Scala Lift chat application and use the instructions to run it, but it fails

I cloned the project from:
https://github.com/dpp/simply_lift.git
Then I followed the instructions which state:
Change directories into the chat directory and type sbt update ~jetty-run.
SBT fetches dependencies, and then I get this:
[error] Not a valid command: jetty-run
[error] Expected '/'
[error] Expected ':'
[error] Not a valid key: jetty-run (similar: run)
[error] jetty-run
[error]
Now what?
In versions of SBT newer than 0.10.0, ~jetty-run has been removed in favour of:
container:start
container:stop
deployment // compiles the changes made while jetty is running.
You should've used sbt from the packaged archive (./sbt). Instead of a system-wide SBT (which may be new).
Anyway, I suggest to use use the new SBT and everything new, too. This is the official and good starting point for a project: https://github.com/lift/lift_25_sbt/
(personally I use it and I'm cool with how it works)

eclipse not accepting my eclipsified todolist application

I am new to play. So naturally I am starting out with the scala todolist tutorial on the official website. But since I want to do the work on eclipse, I am also using this tutorial to eclipsify my project. So I did this
play new todolist
play eclipsify todolist
Then when I try to import the project by doing: File >> import >> general >> existing project into workspace and then point to my project as myPath/todolist, eclipse complained that No projects are found to import. Any help please?
EDIT:
My hunt led me to this tutorial (http:// scala-ide.org/docs/tutorials/play20scalaide20/index.html). So I cd into todolist and start play. Then when I type eclipsify I get the error:
[todolist] $ eclipsify
[error] Not a valid command: eclipsify (similar: eclipse)
[error] Expected '/'
[error] Expected ':'
[error] Not a valid key: eclipsify
[error] eclipsify
[error] ^
eclipsify has been replaced by eclipse in recent versions of sbt, so use that instead.
play eclipse |app name|
Creates the files needed to use the eclipse IDE.
If you want to create the eclipse project that can be imported so, you have to do : "eclipse" command after "sbt"
and then try to import it should work.