jxnu-liguobin / scala-macro-tools Contributors Wanted

[Experimental] The Lombok-like tools implemented in scala by macro, includes the supported IntelliJ plugin.

Version Matrix



Build codecov Maven Central Version


Learn Scala macro and abstract syntax tree.

The project is currently experimental

中文说明 | English


  • Compile passed in Java 8、11
  • Compile passed in Scala 2.11.12、2.12.14、2.13.6


  • @toString
  • @json
  • @builder
  • @synchronized
  • @log
  • @apply
  • @constructor
  • @equalsAndHashCode
  • @jacksonEnum
  • @elapsed
  • @JavaCompatible

The intellij plugin named Scala-Macro-Tools in marketplace.



How to use

Add library dependency

"io.github.jxnu-liguobin" %% "scala-macro-tools" % "<VERSION>"

The artefacts have been uploaded to Maven Central. Importing the library into your build system (e.g gradle, sbt), is not enough. You need to follow an extra step.

Scala 2.11 Scala 2.12 Scala 2.13
Import macro paradise plugin Import macro paradise plugin Enable compiler flag -Ymacro-annotations required
addCompilerPlugin("org.scalamacros" % "paradise_<your-scala-version>" % "<plugin-version>")

Where <your-scala-version> must be the full scala version. For example 2.12.13, and not 2.12.

If that doesn't work, google for alternatives.

In version scala2.13.x, the functionality of macro paradise has been included in the scala compiler directly. However, you must still enable the compiler flag -Ymacro-annotations.