mogli
mogli

Reputation: 1609

generate different jar file for different spec source directory

In our project, we have multiple test source directories. For each test source directory, the requirement is to generate different jar file. How to do that using sbt pack plugin or some other sbt plugin. Simplified project is available at:-

https://github.com/moglideveloper/multiJar

Upvotes: 2

Views: 87

Answers (1)

Tomer Shetah
Tomer Shetah

Reputation: 8539

You just need to add the following 3 lines:

lazy val specA = project.enablePlugins(PackPlugin)
lazy val specB = project.enablePlugins(PackPlugin)
lazy val specC = project.enablePlugins(PackPlugin)

Then each spec will generate a different jar.

If you don't define those projects, sbt assumes that you have only one project. When packing each project creates a different jar, which you can define its own properties.

Please see here which properties you can set. Please see this post to be sure that pack is the one you want to use.

Upvotes: 1

Related Questions