Idea codestyle and inspections maven plugin

627 views java

My team has Idea codestyle and inspections configs exported to share with each other. We have an agreement to have no idea warnings before commit. But we don't have ability to check it at CI side (we use Bitbucket now)

It would be nice to have a maven plugin that will validate the code according to Idea config (in xml) and fail the build if there are errors. Or even two plugins - one for codestyle, other for inspections.

But I can't find any. How to address this?

answered question

1 Answer


There are three most popular options:

  • maven-checkstyle-plugin - generates a report regarding the code style used by the developers. It will do what you want, though you will need a bit of time to adjust checkstyle.xml configuration to what you have in your team
  • spotbugs-maven-plugin - Spotbugs is a successor of FindBugs (which is no longer maintaned) and this would answer your inspection needs
  • maven-pmd-plugin - PMD is another popular choice for inspection, from its documentation:

PMD is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation, and so forth. It supports Java, JavaScript, Apex and Visualforce, PLSQL, Apache Velocity, XML, XSL.

Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code in Java, C, C++, C#, Groovy, PHP, Ruby, Fortran, JavaScript, PLSQL, Apache Velocity, Scala, Objective C, Matlab, Python, Go, Swift and Apex and Visualforce.

Other options include for example Google's Error Prone but the ones I provided are most mature.

posted this

Have an answer?


Please login first before posting an answer.