【问题标题】:How to run specified sub module play application in Intellij如何在 Intellij 中运行指定的子模块播放应用程序
【发布时间】:2015-05-11 08:36:37
【问题描述】:

我有一个包含一些子项目的游戏项目。 我可以在类型安全激活器的控制台中运行播放应用程序 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")

【问题讨论】:

    标签: scala intellij-idea sbt playframework-2.3


    【解决方案1】:

    关于智能 点击菜单

    • 运行 > 编辑配置 > "+" > SBT 任务

      • 在 SBT 任务详细信息窗格中,
      • 在“任务”文本框中输入
      • “项目收集器”运行
      • 在“名称”文本框中输入名称示例“运行收集器”
      • 点击“确定”
    • 点击“运行”>“运行收集器”

    对您的其他项目重复上述步骤 参考文献

    • IntelliJ CE 2017.1
    • SBT 0.13.13

    【讨论】:

      【解决方案2】:

      Play 子模块并不意味着单独运行,它们依赖于main 项目。

      • 子项目没有自己的构建文件,但共享父项目的构建文件。

      • 特别是,application.conf 文件必须只有一个,routes 文件必须只有一个。

      更多详情here.

      【讨论】:

        猜你喜欢
        • 2021-08-23
        • 1970-01-01
        • 1970-01-01
        • 2013-11-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-11-12
        相关资源
        最近更新 更多