我有一个包含一些子项目的游戏项目。 我可以在类型安全激活器的控制台中运行应用程序 1 或 2 - 有选择地喜欢下面。
$ activator "project collector" run
$ activator "project scheduler" run
但是,我找不到在 IntelliJ 中执行此操作的任何引用资料和手册。 我该怎么办?
项目结构是这样的。
root
- collector (play application 1)
- app
- conf
- build.sbt
- scheduler (play application 2)
- app
- conf
- build.sbt
- core
- src
- build.sbt
- util
- src
- build.sbt
- build.sbt
root 的 build.sbt 文件如下所示。
import sbt.Keys._
lazy val commonSettings = Seq(
organization := "com.xxxx",
version := "1.0.0-SNAPSHOT",
scalaVersion := "2.11.6",
javacOptions in Compile ++= Seq("-source", "1.7", "-target", "1.7")
)
lazy val root = (project in file(".")).
aggregate(core, collector, scheduler, util).
enablePlugins(PlayScala).
settings(
name := "collector",
version := "1.0",
scalaVersion := "2.11.6"
)
lazy val core = project.in(file("core")).
settings(commonSettings: _*)
lazy val collector = project.in(file("collector")).
dependsOn(core, util).
settings(commonSettings: _*).
enablePlugins(PlayScala, SbtWeb)
lazy val scheduler = project.in(file("scheduler")).
dependsOn(core, util).
settings(commonSettings: _*).
enablePlugins(PlayScala, SbtWeb)
lazy val util = project.in(file("util")).
settings(commonSettings: _*).
dependsOn(core)
libraryDependencies ++= Seq(
"io.spray" % "spray-io_2.11" % "1.3.2",
"io.spray" % "spray-can_2.11" % "1.3.2",
"io.spray" % "spray-client_2.11" % "1.3.2",
"io.spray" % "spray-http_2.11" % "1.3.2",
"io.spray" % "spray-httpx_2.11" % "1.3.2",
"io.spray" % "spray-util_2.11" % "1.3.2",
"com.typesafe.akka" % "akka-actor_2.11" % "2.3.7",
"com.typesafe.akka" % "akka-contrib_2.11" % "2.3.7",
"com.typesafe.slick" %% "slick" % "2.1.0"
)
Keys.fork in Test := false
addCommandAlias("cc", ";clean;compile")
最佳答案
关于智能 点击菜单
运行 > 编辑配置 > "+"> SBT 任务
- 在 SBT 任务详细信息 Pane 中,
- 在“任务”文本框中输入
- “项目收集器”运行
- 在“名称”文本框中键入名称示例“run collector”
- 点击“确定”
点击“运行”>“运行收集器”
为您的其他项目重复上述步骤 引用文献
- IntelliJ CE 2017.1
- SBT 0.13.13
关于scala - Intellij中如何运行指定的子模块播放应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30163017/