创建简单项目 SBT 0.10.X [英] Create Simple Project SBT 0.10.X
问题描述
(这是对 sbt 未正确创建项目的跟进.该问题未得到解答.)><小时>
基本上,那个问题说我不知道如何在新的 sbt 下创建项目.随着旧的,我只是在一个新文件夹中运行 sbt
并且有一个向导引导我完成设置."
接受的答案没有解释如何创建新的项目,它只是指向文档,它也没有明确说明如何创建一个新项目——只知道如何编写一个 build.sbt
文件.
所以我尝试先写一个 build.sbt
然后在带有 build.sbt
文件的目录中运行 sbt
,但我仍然看不到要使用的 src
目录.
有人可以发布一个简单的分步指南(我假设最多有 3 个步骤)指导如何在 sbt 0.10.X 下创建一个新项目?
我在这个网页上找到了我一直在寻找的答案:Scala 2.9.1、sbt 0.10 和 ScalaTest 一步一步.>
高级步骤是:
mkdir my_project
为你的项目创建一个文件夹创建一个简单的
my_project/build.sbt
文件,例如:name := "一个项目"版本:=0.1"斯卡拉版本:=2.9.1"libraryDependencies ++= Seq("org.scalatest" %% "scalatest" % "1.6.1" % "test")
创建一个文件
my_project/src/main/scala/HelloWorld.scala
,您可以在其中随时创建所需的所有目录(例如创建目录结构src/main/scala/
)object Main 扩展 App {Console.println("你好世界!")}
执行你的 sbt 命令:例如
sbt 运行
(This is a follow up to sbt not creating projects correctly. The question wasn't answered.)
Basically, that question says "I don't know how to create a project under the new sbt. With the old one, I just ran sbt
in a new folder and there was a guided wizard that led me through the setup."
The accepted answer does not explain how to create a new project, it just points to the documentation, which also doesn't explicitly say how to create a new project -- only how to write a build.sbt
file.
So I tried first writing a build.sbt
and then running sbt
in the directory with the build.sbt
file, but I still don't see a src
directory to work with.
Could someone post a simple step-by-step (I'm assuming there are like 3 steps at most) guiding how to create a new project under sbt 0.10.X?
I found the answer I was looking for at this webpage: Scala 2.9.1, sbt 0.10 and ScalaTest step-by-step.
The high-level steps are:
mkdir my_project
make a folder for your projectCreate a simple
my_project/build.sbt
file, e.g.:name := "A Project" version := "0.1" scalaVersion := "2.9.1" libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % "1.6.1" % "test" )
Create a file
my_project/src/main/scala/HelloWorld.scala
, where you create all the directories you need as you go (e.g. create the directory structuresrc/main/scala/
)object Main extends App { Console.println("Hello World!") }
Execute your sbt commands: e.g.
sbt run
这篇关于创建简单项目 SBT 0.10.X的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!