8

What is the best way to add a Scala compiler plugin to the scalaCompile task in Gradle?

vergenzt
  • 9,669
  • 4
  • 40
  • 47

1 Answers1

12
  1. Add a configuration for compiler plugins: configurations { scalaCompilerPlugin }

  2. Add compiler plugin dependencies: dependencies { scalaCompilerPlugin "org.scalamacros:paradise_2.11.7:2.1.0" }

  3. Set up the option: tasks.withType(ScalaCompile) { scalaCompileOptions.additionalParameters = [ "-Xplugin:" + configurations.scalaCompilerPlugin.asPath ] }

I was able to use Macro Paradise in a Gradle-built project with this setup.

vergenzt
  • 9,669
  • 4
  • 40
  • 47