Change the name of the war file in sbt 11.2

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

I tried to redefine some keys without luck

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

...

Evaluate if someone can show me how to change the name of a war file

thanks

+6
source share
2 answers

This should be a 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

+3
source

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

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

Taken from sbt documentation here

+1
source

Source: https://habr.com/ru/post/908580/


All Articles