spotbugsMain error in module 1

I am getting the following error after ./gradlew build

Task :qmoney:spotbugsMain FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:qmoney:spotbugsMain’.

SpotBugs rule violations were found. See the report at: file:///home/crio-user/workspace/adiphisake-ME_QMONEY/qmoney/build/reports/spotbugs/main.html

clear all the problems shown in the terminal(Problem section)
check if you aren’t making the variables of your class as public(if you used class for parsing)
See for details about Spotbugs
https://spotbugs.github.io/

This should help you to fix this issue.

2 Likes

I created a nested static class for parsing json and when i use public variables inside that class the mainReadFile() method works fine but the ./gradlew build gives spotbugs and when i remove public from the variables, the mainReadFile() method gives error.

have you used getter function to get the values of variable??
when you remove public from the variables and make them private
you will only able to access it through your class object
and i will suggest instead of using nested static class, define your own class in another file and then include it in your package
see this
https://www.programiz.com/java-programming/packages-import
spotsbug will give error because making data members static will make them vulnerable to access outside of class