0
votes

I work on a Java project, whose tests I want to convert to scala. I saw that it might be more convenient to package the entire project jar with sbt, rather than with maven.

However, I currently have a single pom.xml file, that creates a jar with all dependencies inside ("fat jar") using maven shade plugin, and runs the tests. This is achieved via the "mvn package" command.

With sbt, I saw that 2-3 files are needed just for the fat jar - build.sbt, assembly.sbt, possibly plugins.sbt.

Is there some way by which I can have a single xxx.sbt file, and run one / several sbt commands, to get the same effect?

1

1 Answers

1
votes

No, you need at least two files: project/plugins.sbt with the

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9")

line and build.sbt with the assembly settings. You can merge the *.sbt files in the root directory, sbt reads them all regardless of the name anyway. But the files in the project/ directory are different. You can read more about it in https://www.scala-sbt.org/1.x/docs/Organizing-Build.html