DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Code Quality Tools in Java

Code Quality Tools in Java

Peter Karussell user avatar by
Peter Karussell
·
May. 25, 09 · Java Zone · Interview
Like (1)
Save
Tweet
65.03K Views

Join the DZone community and get the full member experience.

Join For Free

there are several tools to measure the code quality. the ones i have tried with a lot of success are:

  • findbugs (latest version 1.3.8) – uses static analysis to look for bugs in java code . this is a great tool, it discovered possible nullpointerexceptions and a lot more bugs in my projects. sometimes i asked myself how this program could have discovered this ‘complicated’ bug. with the maven plugin you can do:
    mvn findbugs:findbugs

    which will use version 1.3.8 out of the box

  • pmd (latest version 4.2.5) – scans java source code and looks for potential problems . the rules are configurable, but at the beginning you will only need the provided one (and spend a lot of time to choose your favourites ;-) )in netbeans 6.5 this tool is well integrated and works like a charme (ctrl+alt+p).

    with the maven plugin you can do:

    mvn pmd:pmd

    after you specified the following in the pom.xml under<reporting> <plugins> :

    <plugin>
    <groupid>org.apache.maven.plugins</groupid>
    <artifactid>maven-pmd-plugin</artifactid>
    <version>2.3</version>
    <configuration>
    <targetjdk>1.5</targetjdk>
    </configuration>
    </plugin>

other tools could be

  • jaranalyzer – is a dependency management utility for jar files. it’s primary purpose is to traverse through a directory, parse each of the jar files in that directory, and identify the dependencies between the jar files.
  • hammurapi – a code quality governance platform

but i haven’t tried them so far.

for findbugs  and pmd there is a netbeans plugin ( sqe … software quality environment ) which looks promising, but fails with a nullpointerexception after i installed it via the update center and tried it on my project. maybe i should use one of the snapshots . (btw: i successfully used the pmd-plugin and findbugs in the standalone version).

sonar is another interesting approach to use several code quality tools at a time. with sonar it is possible to see the violations or possible bugs over das or weeks  – so, you are looking at the improvements and you will not get lost in the mass of bugs at the beginning. another “multi-tooling” project is xradar .

a little bit offtopic, but a great tool is proguard, which shrinks, optimizes, obfuscates and preverifies java class files. there is even a maven plugin for that.

from http://karussell.wordpress.com/

Java (programming language)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • MACH Architecture Explained
  • Five Tips to Fasten Your Skewed Joins in Apache Spark
  • API Security Tools: What To Look For
  • Handling Multiple Browser Windows and Tabs in Selenium PHP

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo