$Author: bastafidli $
$Date: 2006/08/27 07:52:10 $
$Revision: 1.9 $
$RCSfile: configuringcheckstyle.html,v $
If you have installed Checkstyle Eclipse Plug-in as instructed in the Development Environment setup, you will receive an error message in the Problems view: "Checkstyle CheckConfig "checkstyle.xml" not found". This is due to the fact that the OpenSubsystems project file, which you have downloaded when you connected to CVS instructs Eclipse to run Checkstyle every time you build project.
Checkstyle plug-in allows you to make your changes to OpenSubsystems code base consistent with the Coding Conventions. As you modify the existing code or write new code, Eclipse automatically checks if your code complies with the configured set of checks and if not, it will display warnings in the Problems view together with other errors.
Before Checkstyle can check your source code you need to configure it with a set of checks that will be used to validate the code. Go to Window menu and select item Preferences. In the Eclipse Preferences windows select the Checkstyle group of settings. Once the Checkstyle dialog displays, select the Sun Checks item in the Check Configurations list and click the Remove button. This will remove the Sun Checks from the list.
Click the Import Checkstyle Config... button and browse to C:\Development\OpenSubsystems\sources\build directory. There you will find file checkstyle.xml. Select the file and click Open. You will be asked if you want to import the file. Confirm the selection. Once all the settings are imported, Checstyle Cheks Configuration Editor dialog opens. Close it by clicking OK button.
Eclipse will start checking all code included in the OpenSubsystems project using the imported Checkstyle configuration. After it is finished you will notice that there are several errors and too many warninings in the Problems view. Don't be worried, these are not triggered by OpenSubsystems code but by the source code included in many external projects, which you have previously extracted. You will have to instruct Checkstyle to do not check the code, which we have no control over.
Go to project properties by right clicking on OpenSubsystems project and selecting Properties from the popup menu. Select Checkstyle group of settings and once the Checkstyle dialog opens, click Edit button. In the Checkstyle File Set Editor dialog click Add button and in the Checkstyle Regular Expression Editor type "external." (including the dot at the end). Click OK button to close the regular expression editor. The external. item was added to the file set list but with Include modifier. Click the checkbox next to it to change it to Exclude. This way Checkstyle will exclude all files in the external directory from compliance check. Now just close all dialogs by clicking OK buttons and wait until Eclipse rechecks all the files.
Eclipse is now ready to be used for development of OpenSubsystems.