Run SpotBugs

SpotBugs is available for Codacy Enterprise, with the following plugins: Find Security Bugs and FBContrib.

To run this tool, you simply need to compile your Java project on your build server, as you would normally do and then invoke the codacy-analysis-cli on the root of the repository.

codacy-analysis-cli analyse --directory <SOURCE-CODE-PATH> --project-token <PROJECT-TOKEN> --allow-network --codacy-api-base-url <API-BASE-URL> --upload --verbose

The Codacy CLI will then run SpotBugs on the compiled classes of your project, parse the results and if you setup the push results options, these results can be sent to Codacy and used in the analysis for the Enterprise version.

Detecting Sources and Compiled Classes

Codacy tries to find the classes and map results to the files automatically. If you use Maven, Gradle and SBT then the default layouts are detected automatically as well.

You have the option to configure these paths manually if there is an issue with detection. To do so, add Codacy configuration file  to the project root - .codacy.yml:

   enabled: true
- classesDirectories: [ "core/target/classes" ]
sourceDirectories: [ "core/src/main" ]
- classesDirectories: [ "api/target/classes" ]
sourceDirectories: [ "api/src/main" ]

 Please reach out to if you need help with anything.

Have more questions? Submit a request


Article is closed for comments.