I'm trying to include macro annotations in my project. Following the documentation, I tried implementing their example.
I am aware that the macro module has to be compiled before the core module (core being the module that contains the code that utilises the macro annotations). To achieve this I created the following build.sbt (version 1.2.8):
name := "test"
lazy val commonSettings = Seq(
version := "0.1",
scalaVersion := "2.12.8"
)
lazy val macros = (project in file("macros")).settings(
commonSettings,
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value
)
lazy val core = (project in file("core")).settings(
commonSettings
) dependsOn macros
The structure of my project is the following:
+-- .idea
+-- core
| +-- src
| | +-- java
| | +-- scala
| | | +-- Test.scala
+-- macros
| +-- src
| | +-- java
| | +-- scala
| | | +-- identity.scala
...
However, when I use the @identity
annotation in the Test class, I still get the message that the macro annotation is not expanded (due to the @compileTimeOnly("enable macro paradise to expand macro annotations")
). Any ideas on why?