Use Lombok, but use sonar warn " Remove this unused "xx" private field "

SnareQube has idea, and resolve this problem? some rule 、plugins …

others:
https://groups.google.com/forum/#!topic/sonarqube/F966q1lV4NY

Hi,
I am very sorry to mention that I don’t have clear idea about what is the problem you are facing and requesting for help.

Could you try to provide a bit more details ?
What are you expecting ? what is not working ? Which versions of sonarjava and sonarqube you are using ?

Thanks to clarify this.

Hello,

I’m experiencing the same issue with false positives on Lombok-annotated classes.
I have set the sonar.java.binaries and sonar.java.libraries in the sonar-project.properties file, but for some reason, the “Remove this unused “id” private field.” messages are still there.

I’ve found the following message in Sonar logs:
"The following classes needed for analysis were missing:
org.springframework…

lombok.Lombok

"

As you can see, there are also some spring classes reported to be missing, although the .jar file of my application is successfully loaded before the analysis.

I’m using SonarQube version 8.3.0.34182.

Thanks,
Nemanja.

To answer my own question - I’ve fixed the issue by including all the dependencies of my application to the build folder.
Basically, I’ve created a gradle task which copies all the .jars to /build/libs/dependencies directory, and I’ve set the sonar.java.libraries in the sonar-project.properties file to point to that directory and voila!

I hope it helps.

Cheers,
Nemanja.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.