play framework2.0.*打war包

首先,使用过play1.*版本的开发者应该都知道要将play项目打包发布,可以直接使用play war命令,但是到了2.*以上的版本,已不再支持play war来打包项目。这里将原因解释如下:
They haven't done this because the Servlet3.1spec has not been released yet. Play 2 supports some features that cannot be supported with Servlet containers <3.1 (probably stuff like web sockets). However, there is a 3rd party plugin that provides this functionality (as long as you avoid the unsupported features):https://github.com/dlecan/play2-war-plugin

所以,想了解原文的,请直接去上述官网细致了解

  下面,我简单介绍如下:

1.plugins.sbt

logLevel := Level.Warn
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
addSbtPlugin("play" % "sbt-plugin" % "2.0.4")
addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "0.8.1")

2.Build.scala

import com.github.play2war.plugin._

val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
     Play2WarKeys.servletVersion := "2.5"    //servlet容器版本
    ).settings(Play2WarPlugin.play2WarSettings: _*)

3.root context deployment

Tomcat 7, Jetty 7/8/9

Rename the generated war ROOT.war before deployment.

4.启动服务器,查看

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值