sbt多项目战争包装

时间:2012-08-14 19:43:56

标签: package war sbt multi-project

我一直在努力寻找将由多个项目组成的Web应用程序打包成一场战争的方法。我为sbt找到的唯一有用的插件是xsbt-web-plugin。我正在尝试在github托管项目中使用War插件,但只有web项目的de依赖项包含在WEB-INF / lib中(不是在构建中定义的其他项目,也不包括它们的依赖项)。我的构建文件是:

import sbt._
import Keys._
import com.github.siasia._
import WarPlugin.warSettings

object BuildSettings {

  import Dependencies._

  val buildOrganization = "ar.edu.itba.it"
  val buildVersion = "1.27"

  val hibernateVersion = "3.6.7.Final"
  val guiceVersion = "3.0"
  val wicketVersion = "1.5.4"
  val jerseyVersion = "1.12"

  val buildSettings = Defaults.defaultSettings ++ Seq(
    organization := buildOrganization,
    version := buildVersion,
    crossPaths := false,
    publishArtifact in (Compile, packageDoc) := false,
    publishArtifact in (Compile, packageSrc) := false,
    parallelExecution in ThisBuild := false,
    libraryDependencies ++= Seq(slf4j_api, slf4j_log4j12, junit, hamcrest_all,         mockito_all, h2, joda_time, guava, junit_interface),
    javacOptions ++= Seq("-source", "1.6", "-target", "1.6"),
    testOptions += Tests.Argument(TestFrameworks.JUnit))
}

object SgaBuild extends Build {
  import BuildSettings._
  import Dependencies._
  import com.github.siasia.WebPlugin._

  val compileAndTest = "test->test;compile->compile"

  lazy val root = Project(id = "sga", base = file(".")) aggregate (itba_common,     itba_common_wicket, itba_common_jpa, jasperreports_fonts_extensions, sga_backend, sga_rest,     sga_wicket) // settings (rootSettings: _*)

  lazy val itba_common = Project(id = "itba-common", base = file("itba-common"))     settings (buildSettings: _*)
  lazy val itba_common_jpa = Project(id = "itba-common-jpa", base = file("itba-common-    jpa")) dependsOn (itba_common % compileAndTest) settings (buildSettings: _*)
  lazy val itba_common_wicket = Project(id = "itba-common-wicket", base = file("itba-    common-wicket")) dependsOn (itba_common % compileAndTest, itba_common_jpa % compileAndTest)     settings (buildSettings: _*)
  lazy val jasperreports_fonts_extensions = Project(id = "jasperreports-fonts-    extensions", base = file("jasperreports-fonts-extensions")) settings (buildSettings: _*)
  lazy val sga_backend = Project(id = "sga-backend", base = file("sga-                backend")) dependsOn (itba_common % compileAndTest, itba_common_jpa % compileAndTest)     settings (buildSettings: _*)
  lazy val sga_rest = Project(id = "sga-rest", base = file("sga-rest")) dependsOn     (sga_backend % compileAndTest) settings (buildSettings: _*)

  lazy val sga_wicket = Project(id = "sga-wicket", base = file("sga-wicket")) dependsOn     (sga_backend % compileAndTest, sga_rest % compileAndTest, itba_common_wicket %     compileAndTest) settings ((buildSettings ++ warSettings(Compile)):_*)

}

object Resolvers {
  val wicketStuff = "Wicket Stuff Repository" at     "http://wicketstuff.org/maven/repository"
}

object Dependencies {

  import BuildSettings._

  ... // (plenty of ModuleIDs that are refered from 7 XXX.sbt)
}

查看插件代码,它似乎将所有文件从full-classpath配置复制到lib目录中,但在检查完整配置时,它不包括所有必需的jar(来自其他7个项目及其依赖项的jar) )。

这是正确使用的插件还是另一个插件?

提前致谢!

0 个答案:

没有答案