播放框架作为SBT非根模块 [英] Play Framework as SBT Non-Root Module

查看:64
本文介绍了播放框架作为SBT非根模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用SBT与核心Java模块和其他Java客户端一起开发Play 2.0 Web应用程序.能否以仍能正确构建Play应用程序的方式进行配置?

I am attempting to develop a Play 2.0 web application alongside a core Java module and other Java clients using SBT. Is it possible to configure this in a way where the Play application is still built properly?

我之前曾开发过一个小型的Play 2.0应用程序,但直接使用SBT的经验为零.到目前为止,我已经提出了以下目录结构和project/Build.scala文件.

I have developed a small one-off Play 2.0 app before but I have zero experience working with SBT directly. So far I have come up with the following directory structure and project/Build.scala file.

root/
 |---common/
 |
 |---client1/
 |---client2/
 |
 |---webapp/
 |    |---app/
 |    |---conf/
 |    |---public/
 |
 |---project/

.

object ApplicationBuild extends Build {

    val appVersion      = "1.0-SNAPSHOT"

    val appDependencies = Seq(
      // Add your project dependencies here,
    )

    val common  = Project("hi-common", file("common"))

    val client1 = Project("hi-client1", file("client1")).dependsOn(common)

    val client2 = Project("hi-client2", file("client2")).dependsOn(common)

    val webapp = PlayProject("hi-webapp", appVersion, appDependencies, path = file("webapp"),  mainLang = JAVA).settings(
        // Add your own project settings here      
    ).dependsOn(common)

    val root = Project("hi", file(".")).aggregate(client1, client2, webapp)

}

运行sbt clean package似乎可以在commonclient1client2模块上正常运行,但是webapp模块没有打包到可以运行webapp/target/start的地步.

Running sbt clean package seems to work appropriately for the common, client1, and client2 modules but the webapp module is not packaged to a point where I can run webapp/target/start.

作为具有正确输出的单个构建,我该怎么做?

What can I do to achieve this as a single build with proper output?

推荐答案

这里的问题是仅运行package目标不足以为您生成启动脚本.它将组装完全打包的Web应用程序,但没有启动它的单一方法.

The problem here is that simply running the package goal is not enough to generate a start script for you. It will assemble the fully package web application but without a single means of starting it.

我的目标是部署到Heroku,后者方便地提供了一个插件,该插件将为您生成此启动脚本.默认情况下,该插件包含的存储库是通过Play 2.0 Web应用程序添加的,因此您所要做的就是将用于构建的命令修改为sbt clean compile stage,您将在start脚本. >文件夹.

My goal was the deployment to Heroku who conveniently provide a plugin which will generate this start script for you. The repository for the plugin's inclusion is added by default with a Play 2.0 web application so all you have to do is modify the commands that you are using for the build to sbt clean compile stage and you will find an start script in the webapp/target/ folder.

这篇关于播放框架作为SBT非根模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆