Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change war file name in sbt 11.2

Tags:

scala

sbt

I'm using sbt 11.2 and xsbt web plugin for a web project (which is multi module). I'm trying to change the war file name generated by sbt. It has version which I like to not to include.

I tried overriding several keys without luck

lazy val admin = Project("admin", file("admin"),
    settings = baseSettings ++ webSettings ++ jettySettings ++ Seq(
      name := "admin",
      moduleName := "my-admin",

...

Appreciate if someone can show me how to change war file name

Thanks

like image 562
Dimuthu Avatar asked Feb 16 '12 04:02

Dimuthu


2 Answers

This ought to to the trick:

++ inConfig(Compile)(
     artifact in packageWar <<= moduleName(n => Artifact("my-" + n, "war", "war"))
)

See:

https://github.com/siasia/xsbt-web-plugin/blob/master/src/main/scala/com/github/siasia/WarPlugin.scala#L60

like image 169
retronym Avatar answered Nov 10 '22 11:11

retronym


In build.sbt, overriding the key artifactName works for me:

artifactName := { (sv: ScalaVersion, module: ModuleID, artifact: Artifact) =>
    artifact.name + "-" + module.revision + "this-goes-in-war-filename." + artifact.extension
}

Taken from the sbt documentation here

like image 40
mariatsji Avatar answered Nov 10 '22 09:11

mariatsji