Search code examples
scalasbtcross-compiling

Enable and disable plugins in sbt file


How do I enable or disable a plugin in build.sbt file in my sbt-cross-platforms project , for example I want to run the jvm only and disable the native and js. Any suggestions to do that?


Solution

  • As per the scala-sbt documentation here:

    You can enable a plugin like this:

    lazy val util = (project in file("util"))
      .enablePlugins(FooPlugin, BarPlugin)
      .settings(
        name := "hello-util"
      )
    

    And disable a plugin like thiS:

    lazy val util = (project in file("util"))
      .enablePlugins(FooPlugin, BarPlugin)
      .disablePlugins(plugins.IvyPlugin)
      .settings(
        name := "hello-util"
      )
    

    You can simply run the following command in the sbt console to get the information about which auto plugins are enabled for a given project:

    plugins
    

    One documentation a day, keeps stackoverflow away.

    Hope this helps. Good luck.