I have used Scala for about a year and now want to get into Lift.
Following the official site, I got the guide at http://simply.liftweb.net/index-Chapter-2.html#toc-Chapter-2
However, the example does not work. Here is the error I get.
C:\Lift\hello>sbt update ~jetty-run
C:\Lift\hello>set SCRIPT_DIR=C:\scala\bin\
C:\Lift\hello>java -Xmx512M -jar "C:\scala\bin\sbt-launch.jar" update ~jetty-run
[info] Set current project to default-7944be (in build file:/C:/Lift/hello/)
[success] Total time: 0 s, completed 22 Feb, 2012 3:41:06 PM
[error] Not a valid command: jetty-run
[error] Not a valid project ID: jetty-run
[error] Not a valid configuration: jetty-run
[error] Not a valid key: jetty-run (similar: run)
[error] ~jetty-run
[error] ^
I have not used sbt before and prefer not to get sidetracked by having to learn sbt, maven or other stuff. I essentially want a "hello" world application (in this case, the chat application) to start up and running before I do any more digging into Lift.
It is unfortunate that the very first example in the official "getting started" guide is broken. Any ideas what the errors are. I tried the method suggested at http://groups.google.com/group/simple-build-tool/browse_thread/thread/60635edfadbcd816 without any luck
UPDATE
If what you want is just a "hello" world Lift application, I will suggest you download the official Lift 2.4 release here.
After you unzip that file, just cd scala_28\lift_blank or cd scala_29\lift_blank according to what Scala version you would like to use.
Then run sbt update ~jetty-run, this release included correct version and SBT start script for windows.
After this, you should able to browse http://localhost:8080 and get a single web page that has current date and time displayed, a typical Hello World program for web framework.
It seems you are using SBT 0.11 but Simply Lift is using SBT 0.7.x.
SBT has been made a lot of changes from 0.7.x to 0.11, there is no jetty-run command in 0.11.
You should download old SBT version if you just want it work and do not care using a old version SBT.
http://code.google.com/p/simple-build-tool/downloads/list
I think 0.7.7 will work.
It seems like you don't have ./ on your path. I believe all you need to do is go into the chat folder and use the command "./sbt update ~jetty-run" instead of "sbt update ~jetty-run".
It's and old question, but I haven't found that solution anywhere yet:
Seems like in lift 2.5 you should do container:start instead of ~jetty-run, so:
./sbt[enter]
update[enter]
container:start[enter]
My chat app was on http://0.0.0.0:8080
Install SBT 0.11+
Create a folder and follow instructions http://www.assembla.com/wiki/show/liftweb/Using_SBT
Copy src folder of https://github.com/lift/lift_24_sbt/tree/master/scala_29/lift_blank (or lift_basic) in your project folder
cd to your project folder and run sbt.
container:start will start server, container:stop to stop
OR use lifty
Related
When I try to create the ScalaTest example with this command:
sbt new scala/scalatest-example.g8 fails on TransportException
I get the following:
[info] Set current project to scala (in build file:/Users/chasrmartin/Dropbox/Etudes/Scala/)
[error] org.eclipse.jgit.api.errors.TransportException: git#github.com:scala/scalatest-example.g8.git: Auth fail
[error] at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:139)
[error] at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:193)
I've tried several workarounds from around the next (eg this SO question) to no avail. It would seem this has to be a simple problem, I got this command from a beginners tutorial.
Update
I got this command from https://www.scala-lang.org/documentation/getting-started-sbt-track/testing-scala-with-sbt-on-the-command-line.html
This project doesn't seems to exists anymore.
Instead I would prefer to run with the normal scala-seed.g8
> sbt new scala/scala-seed.g8
And add the test classes manually.
This is an equivalent tutorial with the same classes and tests.
The scala seed template already comes with the structure you want, with the test dependency. You can run sbt test normally.
I am going through a coursera course and as explained, I am trying to create a new sbt project using the below command:
sbt new scala/hello-world.g8
In a Windows machine. I have sbt 0.13.8 installed. When executing the command it is giving the below error.
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Set current project to workspaces (in build file:/D:/software%20materials%20workspaces/WorkSpaces/)
[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] ^
I am not able to understand what the problem is. Help me out in understanding and solving this problem
I agree with Seth. It looks like the first version to include new is 0.13.13. I just came across this in creating new apps with more recent versions of the Scala Play framework (ex: 2.5). The github templating command line, giter8, is called via sbt new like this:
sbt new scala/scala-seed.g8
On my Mac I ran into a similar issue and fixed it by updating brew (used to install) then updating sbt:
brew update
brew upgrade sbt
First step was needed so the latest sbt could install. If whatever package manager you are using is out of date, it may result in the same problem. Not sure what Windows needs to install but this may help with others landing on this question.
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)
I'm new to Scala and Lift and SBT. I've cloned Ecommerce example from Lift's sample applications.
Now I want to simply run the application.
Documentation says, that container:start should start the app. But I'm getting error:
> container:start
[error] No action named 'container:start' exists.
[info] Execute 'help' for a list of commands or 'actions' for a list of available project actions and methods.
[info]
[info] Total time: 0 s, completed 25.05.2013 16:47:05
I guess that maybe it's because version difference.
[info] using LiftProject with sbt 0.7.5 and Scala 2.7.7
How can I start this application ?
And if it's caused by version difference is it possible to upgrade the application to latest sbt and scala version ?
Update
I've tried to use jetty-start and received another error:
> jetty-start
[error] No action named 'jetty-start' exists.
[info] Execute 'help' for a list of commands or 'actions' for a list of available project actions and methods.
I've also found another similar command jetty-run from sbt help. When I run it I'm getting a huge number of compilation errors. It seems like my scala 2.9.2 cannot compile the code.
This project, as far as I see, uses the old SBT version. The old way to start the web application is:
./sbt
> jetty-start
if you want to reload the app on source change, use ~ jetty-start
Note that there's a far more up to date liftweb project example here: https://github.com/lift/lift_25_sbt
probably sbt did not download the requried jar files.
run the following command
> sbt
> update
now sbt should download the requried jar files
>jetty-run
now sbt should compile and run the web-app.
I have a project that builds well on Unix boxes (http://www.github.com/jhclark/ducttape).
However, using SBT 0.11.2 (and a few other versions of SBT), it will not build on my Mac (OSX 10.5). I get the following cryptic error message:
$ ~/bin/sbt compile (master*? 20:11)
[info] Loading project definition from /Users/jon/Documents/workspace- scala/ducttape/project
[info] Set current project to ducttape (in build file:/Users/jon/Documents/workspace-scala/ducttape/)
[info] Compiling 104 Scala sources to /Users/jon/Documents/workspace-scala/ducttape/target/scala-2.9.2/classes...
[error] error while loading <root>, error in opening zip file
[error] {file:/Users/jon/Documents/workspace-scala/ducttape/}default-024416/compile:compile: scala.tools.nsc.MissingRequirementError: object scala not found.
[error] Total time: 2 s, completed May 27, 2012 8:12:09 PM
This happens even after I clean things out thoroughly with:
sbt clean clean-files
rm -rf ~/.ivy2 ~/.m2 ~/.sbt
I suspect that the real error is happening in Maven2, which SBT uses for dependency management (see also Maven : error in opening zip file when running maven).
However, I'm stumped after several days. Any ideas?
I had similar problems when attempting to use an older version of the sbt-extras launcher with sbt-0.11.3. In my case, it attempted to download a file that didn't exist, and attempted to unzip the 404 error page. The most recent sbt-extras launcher has been fixed for sbt-0.11.3.
Yours sounds different, but they may be due to the the shutdown of scala-tools.org. If you can, I recommend upgrading to sbt-0.11.3.
If you need to continue to use 0.11.2, you should use the 0.11.3-2 launcher, put sbt.version=0.11.2 in project/build.properties, and disable the scalaTools repo in your build.sbt. Mark Harrah posted info on the SBT mailing list.
If this doesn't help, for some reason you're downloading corrupted .jars from somewhere.
Run the command find ~/.ivy2 ~/.m2 ~/.sbt -name "*.jar" -exec unzip -qqt {} \; to find which jar(s) are corrupted. The contents of the corrupt jar may give you a clue as to what's going wrong.
For completion, I had the same problem and it was a corrupt zip/jar file.
However, Dave's command line checks for the usual classpath directories, where your jar may be.
The one causing me troubles was in fact in my projects ./lib folder. I struggled with this for hours, hopefully this may help someone else.
PS: Thanks a lot Dave!
I just had the same problem (on OSX, and with Scala 2.10.2), but the problem turned out not to be in any of my dependency manager repos, or with SBT or Scala (as for some people).
I had put a JAR into /Library/Java/Home/lib/ext/ for other reasons, but didn't make it group- and world-readable. Only root (it's owner) could read it. I tweaked the permissions, and voila. Scala and SBT suddenly work again.
cd /Library/Java/Home/lib/ext
sudo chmod g+r bcprov-jdk15on-1.47.jar
sudo chmod g+a bcprov-jdk15on-1.47.jar