Consider I have a module named myservice
which contains sub modules service1
and service2
myproject/
myservice/
/ service1
/com/sample/process
SomeFile1.scala
SomeFile11.scala
/endpoint
SomeFile13.scala
SomeFile111.scala
/ service2
/com/sample/mov
SomeFile2.scala
SomeFile21.scala
And I have defined built info as:
lazy val service1 = project.in(file("myservice/service1"))
lazy val service2 = project.in(file("myservice/service2"))
lazy val root = (project in file(".")).
enablePlugins(BuildInfoPlugin).
settings(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "?" //What will be the package name here ?
)
Q1. And do I need to enable buildinfo plugin for each module separately as below ?
Q2. And if so what would be the package here
lazy val service1 = project.in(file("myservice/service1"))
enablePlugins(BuildInfoPlugin).
settings(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "?" //What will be the package name here ?
)
lazy val service2 = project.in(file("myservice/service2"))
enablePlugins(BuildInfoPlugin).
settings(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "?" //What will be the package name here ?
)
In the source code I haven't noticed any triggers, so the plugin won't turn on automatically - I would enable it manually for each project that needs to generate it.
Package is where this generated
case class
will be placed. You want it to be put intocom.my.package
and be available in the source code ascom.my.package.BuildInfo
? Then setbuildInfoPackage
to"com.my.package"
.Remember though that if you enable this plugin twice (or more) and in each package you will generate the case class in the same package, then you will have conflicts if anything uses both modules at once. Or if one depend on another. So I would generate this case class only in some common module that the rest of project reuse, unless you want to e.g. publish each module as a library and check in runtime that the library components are in compatible versions (similarly to what Akka does to check that all libraries have matching version) - in such case each module should use different package as a target of the generator.