Exclude Lombok from generated pom.xml using maven-publish

I use the maven-publish plugin to publish a regular jar+pom from a Java project. My source use Lombok (https://projectlombok.org/ ) as a compile time dependency but I do not want this dependency in the generated pom. The nature of Lombok is compile time only so it does not make sense to put it as a runtime dependency in the pom file.
It is similar to what the provided scope does for war files. But the plain Java plugin does not have the provided scope.
Is there a way to avoid the Lombok dependency in the generated pom?

For now, you’ll have to edit the generated pom.xml with the withXml method available with the maven-publish plug-in

There are a couple other options available: a) use the Gradle extra configurations plugin which adds a ‘provided’ configuration or b) assign the Lombok dependency to a separate configuration which you explicitly add to your compile classpath.

configurations {

dependencies {
    lombok 'org.projectlombok:lombok:1.16.4'

sourceSets {
    main {
        compileClasspath += configurations.lombok

The main difference between the two is that option A will include the lombok dependency in your POM with <scope>provided</scope> and option B will omit them from the POM entirely.

Option “b” with the lombok configuration is what I was looking for.
Thank you very much.

I had to add this to make IntelliJ pick up Lombok.

idea {
module {
    scopes.PROVIDED.plus+= [  configurations.lombok]

But now everything work really fine.