I have a multiproject SBT build. When I add plugin.sbt
into subproject/project
with desired addSbtPlugin
declarations, sbt does not load those plugins. Is it intended that all plugins in multi-project should be global - added to <root>/project/plugins.sbt
rather than into subprojects?
Ideally I'd like to have some plugin tasks under particular subproject only: subproject/somePluginTask
.
I have SBT 0.13.5
Plugins can be installed for all your projects at once by declaring them in $HOME/. sbt/1.0/plugins/ . $HOME/. sbt/1.0/plugins/ is an sbt project whose classpath is exported to all sbt build definition projects.
A plugin can define a sequence of sbt settings that are automatically added to all projects or that are explicitly declared for selected projects. For example, a plugin might add a proguard task and associated (overridable) settings. Finally, a plugin can define new commands (via the commands setting).
In a console, cd to the top-level folder of your existing sbt project, and enter sbt eclipse to generate the Eclipse project files for all projects in your build. Start Eclipse and switch to the Workspace you want to use for your Lagom project. From the File menu, select Import. The Select screen opens.
A project is defined by declaring a lazy val of type Project. For example, : lazy val util = (project in file("util")) lazy val core = (project in file("core")) The name of the val is used as the subproject's ID, which is used to refer to the subproject at the sbt shell.
As noted in Getting Started Guide a build in sbt is a root project of a build located in project/
directory at the level. Since you have one build that's expressing the top-level multi project, the only directory that's looked into is <root>/project/
.
Prior to sbt 0.13.5, the best practice guide suggested that plugins do not override settings
and provide something like obfuscateSettings
so you can opt into the plugin at the project level. In other words, plugins are added at the build level, but the plugin settings are only loaded to each project if you wanted to. The plugins you're using may or may not be following this guide.
The main feature that was introduced in sbt 0.13.5 is auto plugin, which should make it easier for you to not only enable plugins at each project level but also disable them if they were loaded automatically.
lazy val app = (project in file("app"))
.enablePlugins(HelloPlugin)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With