Rpm
sbt 正在執行但在埠 9000 上看不到 centos 6.5
下載 sbt.rpm(版本 0.13.1)並使用 yum 安裝後,它似乎執行成功,但是當我轉到http://mysite.com:9000時卻找不到它。
這是命令後的一些輸出
sbt
ent/0.13.1/jars/test-agent.jar ... [SUCCESSFUL ] org.scala-sbt#test-agent;0.13.1!test-agent.jar (1248ms) downloading http://repo1.maven.org/maven2/org/scala-sbt/test- interface/1.0/test-interface-1.0.jar ... [SUCCESSFUL ] org.scala-sbt#test-interface;1.0!test-interface.jar (864ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala- sbt/apply-macro/0.13.1/jars/apply-macro.jar ... [SUCCESSFUL ] org.scala-sbt#apply-macro;0.13.1!apply-macro.jar (1946ms) :: retrieving :: org.scala-sbt#boot-app confs: [default] 43 artifacts copied, 0 already retrieved (12646kB/207ms) Getting Scala 2.10.3 (for sbt)... downloading http://repo1.maven.org/maven2/org/scala-lang/jline/2.10.3/jline- 2.10.3.jar ... [SUCCESSFUL ] org.scala-lang#jline;2.10.3!jline.jar (1180ms) downloading http://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.4/jansi-1.4.jar ... [SUCCESSFUL ] org.fusesource.jansi#jansi;1.4!jansi.jar (1316ms) :: retrieving :: org.scala-sbt#boot-scala confs: [default] 5 artifacts copied, 0 already retrieved (24447kB/136ms) [info] Set current project to local (in build file:/usr/local/) >
然後命令
run
,我得到以下資訊:java.lang.RuntimeException: No main class detected. at scala.sys.package$.error(package.scala:27)
我試圖讓它執行,這樣我就可以玩 scala 語言五子棋遊戲。
更進一步,我已將 wbillingsley/play-backgammon scala 文件夾放入 /usr/local/src/main/scala ,現在當我執行命令時,我得到以下資訊:
Loading /usr/share/sbt/bin/sbt-launch-lib.bash [info] Set current project to local (in build file:/usr/local/) > run [info] Compiling 8 Scala sources to /usr/local/target/scala-2.10/classes... [error] /usr/local/src/main/scala/play- backgammon/app/controllers/Application.scala:3: not found: object play [error] import play.api._ [error] ^ [error] /usr/local/src/main/scala/play- backgammon/app/controllers/Application.scala:5: not found: object play [error] import play.api.mvc._ [error] ^ [error] /usr/local/src/main/scala/play- backgammon/app/controllers/Application.scala:8: not found: object play [error] import play.api.libs.json._ [error] ^
這是我用來完成這項工作的步驟。請注意,我只使用了您提供的 2 個 URL:
步驟 #1 - 安裝 SBT
我執行了以下 2 個命令來下載和安裝 SBT。
$ wget http://repo.scala-sbt.org/scalasbt/sbt-native-packages/org/scala-sbt/sbt/0.13.1/sbt.rpm $ sudo yum localinstall sbt.rpm
步驟 #2 - 複製 GIT 儲存庫
接下來,我執行這個命令來複製一個用於西洋雙陸棋遊戲的 GitHub 儲存庫副本。
$ git clone https://github.com/wbillingsley/play-backgammon.git
步驟 #3 - 編譯五子棋
您可能忽略的關鍵步驟是您必須在執行 SBT 之前將目錄更改為五子棋遊戲。
$ cd play-backgammon
現在從項目目錄中執行
sbt
.$ sbt Loading /usr/share/sbt/bin/sbt-launch-lib.bash Getting org.scala-sbt sbt 0.12.1 ... downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.12.1/jars/sbt.jar ... [SUCCESSFUL ] org.scala-sbt#sbt;0.12.1!sbt.jar (697ms) downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/main/0.12.1/jars/main.jar ... [SUCCESSFUL ] org.scala-sbt#main;0.12.1!main.jar (2133ms) ... Getting Scala 2.9.2 (for sbt)... downloading http://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.9.2/scala-compiler-2.9.2.jar ... [SUCCESSFUL ] org.scala-lang#scala-compiler;2.9.2!scala-compiler.jar (6836ms) downloading http://repo1.maven.org/maven2/org/scala-lang/scala-library/2.9.2/scala-library-2.9.2.jar ... [SUCCESSFUL ] org.scala-lang#scala-library;2.9.2!scala-library.jar (4865ms) downloading http://repo1.maven.org/maven2/org/scala-lang/jline/2.9.2/jline-2.9.2.jar ... [SUCCESSFUL ] org.scala-lang#jline;2.9.2!jline.jar (388ms) :: retrieving :: org.scala-sbt#boot-scala confs: [default] 4 artifacts copied, 0 already retrieved (20090kB/71ms) [info] Loading project definition from /home/saml/programming_projects/scala/play-backgammon/project [info] Set current project to play-backgammon (in build file:/home/saml/programming_projects/scala/play-backgammon/) [play-backgammon] $
步驟 #4 - 執行遊戲
[play-backgammon] $ run Getting Scala 2.10.0-RC1 ... downloading http://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.10.0-RC1/scala-compiler-2.10.0-RC1.jar ... [SUCCESSFUL ] org.scala-lang#scala-compiler;2.10.0-RC1!scala-compiler.jar (9087ms) downloading http://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.0-RC1/scala-library-2.10.0-RC1.jar ... [SUCCESSFUL ] org.scala-lang#scala-library;2.10.0-RC1!scala-library.jar (3653ms) downloading http://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.10.0-RC1/scala-reflect-2.10.0-RC1.jar ... [SUCCESSFUL ] org.scala-lang#scala-reflect;2.10.0-RC1!scala-reflect.jar (2091ms) downloading http://repo1.maven.org/maven2/org/scala-lang/jline/2.10.0-RC1/jline-2.10.0-RC1.jar ... [SUCCESSFUL ] org.scala-lang#jline;2.10.0-RC1!jline.jar (479ms) :: retrieving :: org.scala-sbt#boot-scala confs: [default] ... ... [info] downloading http://repo1.maven.org/maven2/org/w3c/css/sac/1.3/sac-1.3.jar ... [info] [SUCCESSFUL ] org.w3c.css#sac;1.3!sac.jar (372ms) [info] downloading http://repo1.maven.org/maven2/org/jboss/netty/netty/3.2.7.Final/netty-3.2.7.Final.jar ... [info] [SUCCESSFUL ] org.jboss.netty#netty;3.2.7.Final!netty.jar(bundle) (656ms) [info] downloading http://repo1.maven.org/maven2/org/easytesting/fest-util/1.1.6/fest-util-1.1.6.jar ... [info] [SUCCESSFUL ] org.easytesting#fest-util;1.1.6!fest-util.jar (331ms) [info] Done updating. --- (Running the application from SBT, auto-reloading is enabled) --- [info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000 (Server started, use Ctrl+D to stop and go back to the console...)
第 5 步 - 玩!
一旦你到了這一點,你就可以啟動你的網路瀏覽器並通過 URL 訪問遊戲
http://localhost:9000
。