在Gradle中向scalaCompile任务添加Scala编译器插件的最佳方法是什么?
What is the best way to add a Scala compiler plugin to the scalaCompile task in Gradle?
推荐答案
为编译器插件添加配置: configurations { scalaCompilerPlugin }
Add a configuration for compiler plugins: configurations { scalaCompilerPlugin }
添加编译器插件依赖项: dependencies { scalaCompilerPlugin "org.scalamacros:paradise_2.11.7:2.1.0" }
Add compiler plugin dependencies: dependencies { scalaCompilerPlugin "org.scalamacros:paradise_2.11.7:2.1.0" }
设置选项: tasks.withType(ScalaCompile) { scalaCompileOptions.additionalParameters = [ "-Xplugin:" + configurations.scalaCompilerPlugin.asPath ] }
Set up the option: tasks.withType(ScalaCompile) { scalaCompileOptions.additionalParameters = [ "-Xplugin:" + configurations.scalaCompilerPlugin.asPath ] }
我能够在Gradle中使用Macro Paradise设置的项目.
更多推荐
Gradle Scala插件推论到sbt中的addCompilerPlugin
发布评论