projectlombok / lombok

Very spicy additions to the Java programming language.
https://projectlombok.org/
Other
12.83k stars 2.37k forks source link

[BUG] After Lombok adding to dependency Gradle cannot access to javax.xml.* library #3458

Open MaltsevDmytro opened 1 year ago

MaltsevDmytro commented 1 year ago

Describe the bug When I added Lombok dependency to my build.gradle file and lombok.config file I cannot compile my project with error cannot access XmlRootElement. After investigation I find out that transient dependency provided by third party library javax.xml is absent in my dependency tree. I was trying to built project through, gradlew file, internal gradle of IntelijIdea and installed gradle on my pc, also invalidate cache, reinstall IDE, redownload project from remote repository. Also changing Lombok version from 1.18.28 to 1.16.20 didn't help. When I remove all new deps and files everything works fine.

To Reproduce Stacktrace of gradle build:

> Task :compileJava FAILED
error: cannot access XmlRootElement
  class file for javax.xml.bind.annotation.XmlRootElement not found

lombok.config:

config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true
lombok.extern.findbugs.addSuppressFBWarnings = true
lombok.anyConstructor.addConstructorProperties = true

build.gradle:

dependencies {
    annotationProcessor(group: 'org.projectlombok', name: 'lombok', version: LOMBOK_VERSION)
    compileOnly(group: 'org.projectlombok', name: 'lombok', version: LOMBOK_VERSION)

    //Other deps
}

Expected behavior Build without any errors

Version info (please complete the following information):

Rawi01 commented 1 year ago

Lombok does not generate code with this annotation. Why do you think this is a lombok problem and not one related to the other dependencies or your project code?

The compiler should print a location where this annotation is used, that should help you to find the root cause.

MaltsevDmytro commented 1 year ago

I doublecheck and I am sure that Lombok somehow trigger this problem, all messages from complier is presented in previous comment.

alexanderankin commented 1 year ago

can provide a reproducer or the rest of the dependency list?