Plugins
Popular Plugins
If you are searching for interesting plugins, refer to this article for some suggestions. The list below also collects some popular ones:
- sbt-native-packager: Build application packages in native formats; for instance, you can package a command-line interface (CLI) as an executable program
- sbt-assembly: Deploy fat JARs
- sbt-docker: Create Docker images directly from sbt
- scalafmt: Code formatter for Scala
- mdoc: Typechecked markdown documentation for Scala
- sbt-buildinfo: Generates a Scala object with SBT build parameters so you can use them in your code
Create a Plugin
If you are planning to create your own SBT plugin, refer to the following resources:
- Plugins
- Plugins Best Practices
- Tasks
- How to Build and Deploy a Simple SBT Plugin
- SBT Plugin – How to make it, debug it, improve it?
- Building and testing sbt plugins
If you plan to have your SBT plugin call a shell script internally, refer to this Stack Overflow answer. Remember that your plugin will be imported into client projects as a jar file, therefore task definitions in your plugin won't be able to simply call the shell script directly. Instead, your plugin should store the shell script in src/main/resources
. By storing it there, it will be accessible on the resource path of the client project at runtime. Your plugin can define a task to copy the contents of the resource, write them to a temporary file (perhaps the client project's target
directory), make it executable, and finally run the script (refer to Execute Shell Commands from Scala Code).