Gradle Scala Plugin corollary to addCompilerPlugin in sbt

Hi,

Searching for ‘gradle add subcut scala compiler plugin’ returns nothing helpful.

What is gradle’s corollary to sbt’s addCompilerPlugin?

Thanks, Matt

It should be possible to accomplish this by passing the correct ‘scalac’ command line arguments. For example:

compileScala.scalaCompileOptions.additionalParameters = ["-Xplugin:path/to/plugin.jar"]

‘scalac -X’ shows the following compiler plugin related command line arguments:

-Xplugin:<file>
              Load one or more plugins from files.
  -Xplugin-disable:<plugin>
    Disable the given plugin(s).
  -Xplugin-list
                Print a synopsis of loaded plugins.
  -Xplugin-require:<plugin>
    Abort unless the given plugin(s) are available.
  -Xpluginsdir <path>
          Path to search compiler plugins.

Thanks Peter. I placed the full path to subcut in that parameter and that worked.

I’ll have to set the rest of this aside for later research.

I didn’t see a straightforward way to grab the path of the subcut dependency in my build file to substitute in “-Xplugin:path/to/plugin.jar”.

That, coupled with the fact that it shows annoying error markers in the IDE, has led me to use the less convenient mechanism that doesn’t require the plug-in.

Cheers, Matt

1 Like