BlueJ Checkstyle Extension Home Page

Checkstyle Logo

Overview

The BlueJ Checkstyle extension is a wrapper for Checkstyle, a development tool to help programmers write Java code that adheres to a coding standard.

Features

Uses Checkstyle v4.3.

The user can choose the Checkstyle configuration file that specifies which checks are applied to the Java code. The extension distribution includes sample configuration files for the Sun Code Conventions, the Big Java Coding Guidelines, and a sample course-specific configuration file used at Virginia Tech.

The user can specify the properties file for Checkstyle properties expansion.

Both configuration and properties files can be dynamically loaded from the web.

The extension presents the Checkstyle results in an output window.

Requirements

  • BlueJ running on JDK 5 (1.5.x) or higher.

Download

The latest release of the BlueJ Checkstyle extension can be downloaded from the SourceForge download page.

Installation

  • Download the latest version of the extension jar file.

  • Place it in BlueJ's extensions directory:

    • Under Windows or Unix, place the jar in <BLUEJ_HOME>/lib/extensions, where <BLUEJ_HOME> is the directory where BlueJ is installed.

    • Under Mac OSX, place the jar in /Applications/BlueJ.app/Contents/Resources/Java/extensions (Control-click BlueJ.app and choose Show Package Contents).

  • If you are upgrading from an earlier version, remove the older checkstyle-extension*.jar file, as well as the checkstyle subdirectory, from your extensions directory. If you have added any customized configuration files yourself, be sure to keep them.

Usage

  • Open BlueJ.

  • To run a check on all files in the current package, choose Checkstyle from the Tools menu.

Settings

User Preferences

  • The extension uses its built-in default_checks.xml file unless you specify a different configuration file in your preferences.

  • To specify the Checkstyle configuration file or properties file, choose Preferences... from the Tools menu (or from the BlueJ menu under Mac OSX). In the preferences panel, click on the Extensions tab. In the "Checkstyle" section, enter the file name for the checkstyle configuration XML file and/or properties file you wish to use.

  • In addition to local file names, you can also use URLs in the preferences settings.

  • To use one of the built-in configuration files, simply enter one of these file names with no path or directory in the Preferences panel:

Shared/Lab Configuration

If you are preparing a collection of machines that use a shared or cloned copy of a BlueJ distribution, you may want them all to use the same configuration setup. There are several ways you can achieve this goal.

  1. Write your own custom checks and place them in a file named default_checks.xml in BlueJ's lib/extensions (or lib) directory. Then the extension will use your custom file, instead of its built-in version of default_checks.xml.

  2. To use one of the built-in configurations instead of your own custom configuration, add a line like this to the lib/bluej.defs file in your master copy of BlueJ:

    extensions.com.puppycrawl.tools.checkstyle.plugins.bluej.CheckstyleExtension.settings.checkstyle.configfile=bigjava_checks.xml

    This has the same effect as pre-initializing the preferences setting for the extension. Users will still be able to override this setting in their own preferences, but all will start out using the default you provide. You can use the name of any of the built-in configuration files, or the path name of your own custom file. You can set the properties file setting using the same technique:

    extensions.com.puppycrawl.tools.checkstyle.plugins.bluej.CheckstyleExtension.settings.checkstyle.propsfile=/path/to/my/file.properties

  3. The options above will work if you want to distribute a single static configuration choice that will work for a long time. If your configuration changes more frequently, however, you can use a URL instead. Set the configfile property in lib/bluej.defs as described above, but give a URL that points to your configuration file. The same technique works with the properties file, too. Now the extension will dynamically load your configuration over the web. If the extension cannot retrieve the remote configuration it will issue and appropriate warning and fall back to using default_checks.xml.

Contact

rick.giles at acadiau.ca

edwards at cs.vt.edu