Home > Back-end >  Java library delombok the code at compile time
Java library delombok the code at compile time

Time:12-21

I am building a java library and using Lombok in it. But I want to decompile the lombok code at compile time so the users of that library don't have to import lombok dependency.

My build.gradle looks like this

apply plugin: 'java-library'

repositories {
  mavenCentral()
}

dependencies {
    compileOnly "org.projectlombok:lombok:1.18.16"
    annotationProcessor "org.projectlombok:lombok:1.18.16"
}

CodePudding user response:

I am building a java library and using Lombok in it. But I want to decompile the lombok code at compile time so the users of that library don't have to import lombok dependency.

You misunderstand lombok. Lombok is not neccessary for users of code that is compiled with lombok. Lombok is a 'compile time only dependency', and only when compiling stuff that is actually using lombok.

Nothing remains of lombok itself when lombok is done.

In other words, what you have now? That's all you need. There's nothing left to do. Try it! You can decompile your own program after its done and you'll find that lombok annotations don't exist anywhere inside it. You can write code that uses your program/library without lombok on the classpath and it works just the same.

  • Related