If your project is in directory `hello`, edit `hello/project/plugins.sbt` and declare the plugin dependency by passing the plugin's Ivy module ID to `addSbtPlugin`: ::
Not every plugin is located on one of the default repositories and a plugin's documentation may instruct you to also add the repository where it can be found: ::
As of sbt 0.13.2, there is a new :doc:`auto-plugins <../DetailedTopics/AutoPlugins>` feature that enables plugins
to automatically, and safely, ensure their settings and dependencies are on a project. Most plugins should have
their default settings automatically, however some may require explicit enablement.
If you're using a plugin that requires explicit enablement, then you you have to add the following to your
`build.sbt` ::
lazy val util = project.setPlugins(ThePluginIWant)
Most plugins document whether they need to explicitly enabled. If you're curious which plugins are enabled
for a given project, just run the `plugins` command on the sbt console.
For example ::
> plugins
In file:/home/jsuereth/projects/sbt/test-ivy-issues/
sbt.plugins.IvyModule: enabled in test-ivy-issues
sbt.plugins.JvmModule: enabled in test-ivy-issues
sbt.plugins.GlobalModule: enabled in test-ivy-issues
Here, the plugins output is showing that the sbt default plugins are all enabled. Sbt's default settings are provided via three plugins:
1. GlobalModule: Provides the core parallelism controls for tasks
2. IvyModule: Provides the mechanisms to publish/resolve modules.
3. JvmModule: Provides the mechanisms to compile/test/run/package Java/Scala projects.
However, older plugins often required settings to be added explictly, so that :doc:`multi-project build <Multi-Project>` could have different types of projects. The plugin documentation will indicate how to configure it, but typically for older plugins this involves adding the base settings for the plugin and customizing as necessary.
3. Define an `object` that extends `AutoPlugin` or `RootPlugin`. The contents of this object will be automatically imported in `.sbt` files, so ensure it only contains important API definitions and types.
5. Collect the default settings to apply to a project in a list for the user to add. Optionally override one or more of `AutoPlugin`'s methods to have settings automatically added to user projects.
6. (Optional) For non-root plguins, declare dependencies on other plugins by overriding the `select` method.