SBT Compiler Plugin as Transitive Dependency

Tag: scala , macros , sbt Author: flying888_999 Date: 2014-04-19

I have a library that uses the macro paradise plugin (referred to as macro-provider library). In the build.sbt,

addCompilerPlugin("org.scalamacros" % "paradise" % "2.0.0" cross CrossVersion.full)

to gain access to the macro annotations.

When adding the macro library as a libraryDependency to a separate project (referred to as macro-consumer project), the annotations are present, but the macro implementation is never called. Adding the macro paradise compiler plugin to the macro-consumer project libraryDependencies solves the problem.

Is it possible to include compiler plugins as transitive dependencies? This would free consumers of the macro library from adding the required plugin.

Update #1:

The addCompilerPlugin helper adds the dependency to the libraryDependencies and sets the dependency with a configuration = Some("plugin->default(compile)") within the macro-provider library.

Adding the paradise dependency in the libraryDependencies of the macro-provider library causes the artifact to show up in the macro-consumer project. It does not add the dependency as a compiler plugin.

Update #2:

Setting autoCompilerPlugins := true in the macro-consumer project in conjunction with Update #1 does not resolve the issue.