scala.meta annotation not recognised

Scala.meta seems to be partially working, in that it seems to understand the basic quasi quotes in my example main app. However the annotation definition below will not compile - I get the error:

Error:(20, 10) ';' expected but 'def' found.
     inline def apply(defn: Any): Any = meta {

I can't see anything significantly different between this and the example on the Scala.meta tutorial - this is a cutdown example for the posting here. IDEA even recognises that this is a 'meta program' and offers to compile it.

I'm using:

    IDEA 2016.3.4 (build #UI-163.12024-16 - Jan31st) 

    Scala plugin (2016.3.8)

    Scala 2.11.7


    jvm 1.8

    Gradle 3.1 via IDEA

Have also tried EAP and Nightly builds


Any ideas how to get this working please?


dependencies {
compile 'org.scala-lang:scala-library:2.11.7'

dependencies {
compile group: 'org.scalameta', name: 'scalameta_2.11', version: '1.4.0'


My example program

package mymeta.test

import scala.annotation.StaticAnnotation
import scala.meta._

class MySyncTest

object MetaTest extends App {
val x = q"x + y"

class mysync extends StaticAnnotation {
inline def apply(defn: Any): Any = meta {
q"1 + 2"
Comment actions Permalink
Official comment

You are missing paradise plugin for Scala compiler, which is required to support the inline keyword.

Please try adding it with

dependencies {
scalaCompilerPlugin "org.scalameta:paradise_2.11.7:3.0.0-M8"
Comment actions Permalink

Hi Mikhail,


There is no `scalaCompilerPlugin` configuration in gradle - the gradle scala plugin doesn't create one.

I have however managed to implement one, which results in the library being added to the scala SDK. But it assumes you're using nebula to recommend the scala version (or you'd have to write down the version yourself).

By writing the following code into a scala.gradle and then importing that into every project that needs scala:

apply plugin: 'scala'

// Figure out scala version using nebula.
// If you're not using nebula, you must figure it out from the ScalaCompile.getClasspath() just like ScalaBasePlugin does
ext.scalaVersion = rootProject.dependencyRecommendations.getRecommendedVersion(
'org.scala-lang', 'scala-library') as String

configurations.create('scalaCompilerClasspath') {
visible = false

dependencies {
scalaCompilerClasspath "org.scala-lang:scala-compiler:${scalaVersion}".toString()

tasks.withType(ScalaCompile) {
// Override the scala classpath inference done in ScalaBasePlugin.configureCompileDefaults
scalaClasspath = configurations.scalaCompilerClasspath

Please sign in to leave a comment.