play app to war

project/Build.scala

import sbt._
import Keys._
import play.Play.autoImport._
import PlayKeys._
import com.typesafe.sbt.less.SbtLess.autoImport._
import com.typesafe.sbt.rjs.Import._
import com.typesafe.sbt.digest.Import._
import com.typesafe.sbt.gzip.Import._
import com.typesafe.sbt.web.Import._
import com.github.play2war.plugin._
import com.typesafe.sbteclipse.plugin.EclipsePlugin._

object ApplicationBuild extends Build {
    val appName = "webapp"
    val appVersion = "1.0-SNAPSHOT"

    lazy val commonSettings = Seq(
            version := appVersion,
            scalaVersion := "2.11.6"
    )

    lazy val assetSettings = Seq(
         pipelineStages := Seq(rjs, digest),
      
         //LESS configs
         includeFilter in (Assets, LessKeys.less) := "*.less",
         excludeFilter in (Assets, LessKeys.less) := "_*.less",
         LessKeys.compress in Assets := true,
        
         //RequireJS configs
         //RjsKeys.mainModule := "main",    
         includeFilter in rjs := GlobFilter("*.js"),
         excludeFilter in rjs := GlobFilter(""),
         RjsKeys.generateSourceMaps := false,
         RjsKeys.paths := Map(
              "angular" -> ("../lib/angularjs/angular", "../lib/angularjs/angular")
         )//,        
         //RjsKeys.modules := Seq(
             //WebJs.JS.Object("name" -> "angularDemoMain"),
             //WebJs.JS.Object("name" -> "userMain")
         //)
    )

    var appDependencies = Seq(
        "org.webjars" % "angularjs" % "1.3.15",
        "org.webjars" % "jquery" % "1.10.2",
        "org.webjars" % "bootstrap" % "3.1.1",
        "org.webjars" % "requirejs" % "2.1.15",

        "org.codehaus.janino" % "janino" % "2.7.8",
        "org.julienrf" %% "play-jsmessages" % "1.6.2",
        "mysql" % "mysql-connector-java" % "5.1.23",
        javaJdbc,
        javaEbean,
        cache,
        javaWs,
        javaJdbc,
        javaEbean,
        cache,
        javaWs,
        filters
    )

    lazy val warProjectSettings = Play2WarPlugin.play2WarSettings ++ Seq(
        Play2WarKeys.filteredArtifacts := Seq()
    )

    lazy val root = Project(appName, file("."))
        .enablePlugins(play.PlayJava)
        .settings(commonSettings ++ assetSettings ++ warProjectSettings: _*)
        .settings(
            //javaOptions in Test += "-Dconfig.file=conf/application.test.conf",
            libraryDependencies ++= appDependencies,
            //libraryDependencies ++= Seq("com.github.play2war.ext" %% "redirect-playlogger" % "1.0.1"),
            Play2WarKeys.servletVersion := "3.0",
            Play2WarKeys.explodedJar := true,
            EclipseKeys.withSource := true
        )
        //.aggregate(sdk)
        .dependsOn(sdk)

    lazy val sdk = RootProject(file("../sdk"))
}

 

posted on 2015-06-04 10:42  jmbkeyes  阅读(228)  评论(0编辑  收藏  举报

导航