我正在嘗試創建一個新項目,這次是使用sbt 1.0.2而不是0.13.x,我現在用了很長一段時間。Sbt 0.13到1.0 - 在多項目中,Global的onLoad替代項目是什麼?
在那裏,我不得不https://github.com/vmunier/akka-http-with-scalajs-example/blob/master/build.sbt
我的問題多的項目設置可比現在是我總是得到[error] (projectname/compile:bgRun) No main class detected.
當我嘗試運行sbt run
這裏是我當前build.sbt
文件:
lazy val generalSettings = Seq(
name := "awesomeproject.tld",
version := "0.1",
scalaVersion := "2.12.3"
)
lazy val client = (project in file("modules/client"))
.settings(generalSettings: _*)
.settings(
name := "client",
libraryDependencies ++= Seq(
"com.lihaoyi" %%% "scalatags" % "0.6.5",
"org.scala-js" %%% "scalajs-dom" % "0.9.2"
)
, scalaJSUseMainModuleInitializer := true
)
.enablePlugins(ScalaJSPlugin, ScalaJSWeb)
.dependsOn(sharedJS)
lazy val server = (project in file("modules/server"))
.settings(generalSettings: _*)
.settings(
name := "server",
scalaJSProjects := Seq(client),
pipelineStages in Assets := Seq(scalaJSPipeline),
// triggers scalaJSPipeline when using compile or continuous compilation
//compile in Compile := ((compile in Compile) dependsOn scalaJSPipeline).value,
WebKeys.packagePrefix in Assets := "public/",
//managedClasspath in Runtime += (packageBin in Assets).value,
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.5.4",
"com.typesafe.akka" %% "akka-testkit" % "2.5.4" % Test,
"com.typesafe.akka" %% "akka-stream" % "2.5.4",
"com.typesafe.akka" %% "akka-stream-testkit" % "2.5.4" % Test,
"com.typesafe.akka" %% "akka-http" % "10.0.10",
"com.typesafe.akka" %% "akka-http-testkit" % "10.0.10" % Test,
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.typesafe.scala-logging" %% "scala-logging" % "3.7.2",
"com.lihaoyi" %% "scalatags" % "0.6.5",
"com.vmunier" %% "scalajs-scripts" % "1.1.0"
)
, mainClass := Some("tld.awesomeproject.Main")
)
.dependsOn(sharedJVM)
lazy val shared = (crossProject.crossType(CrossType.Pure) in file("modules/shared"))
.settings(generalSettings: _*)
.settings(
name := "shared"
)
lazy val sharedJS = shared.js
lazy val sharedJVM = shared.jvm
正如你所看到的,我試圖解決這個問題,並在子版中用mainClass := Some("tld.awesomeproject.Main")
明確設置項目。我也嘗試明確地設置一個根項目,使其依賴於服務器,但沒有運氣。
我在這裏想真正的問題是,
onLoad in Global := (Command.command("project server", _: State)) compose (onLoad in Global)
不SBT 1.0.2工作了。
我檢查了Command
班,但我並不聰明。根本沒有更多的方法可以回饋一個國家。
任何人都可以擺脫這樣嗎?我想要的是運行一個向客戶端發送一些javascript的服務器......這不應該是黑魔法,事實上,在我的0.13版本中,所有的東西都像魅力一樣。項目。