Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SBT - How to disable a plugin for a specific task (e.g. "package")

Tags:

sbt

sbt-plugin

Is there a way to disable a SBT plugin (an AutoPlugin) for a specific task.

For example, i would like to disable the plugin SCoverage while packaging.

I tried with:

coverageEnabled in `package` := false

But that does not work. So I look for a way to wholly disable the plugin.

like image 246
Mat Avatar asked Dec 15 '15 10:12

Mat


1 Answers

No. By the time a task is being executed (in this case packageBin task), the task dependency graph has been loaded from all auto plugins, and each setting/task wouldn't know if it came from a plugin or not. In general, you can't dynamically enable or disable plugins in sbt as of today (0.13.9).

Some plugins might add extension points specifically to override some behaviors (for example, test in assembly), but built-in tasks such as packageBin are not aware of the plugins.

I tried to propose a concept called build level, which might be related here, but it did not catch on.

like image 69
Eugene Yokota Avatar answered Sep 19 '22 08:09

Eugene Yokota