You can run code reviews on Java™ source code from a command line in a headless workbench, with no graphical user interface. This might be useful if you want to run code reviews unattended on a regular basis.
A headless, or command line interface (CLI) for code review analyses enables you to interact with the analysis feature in a textual environment. When you run an analysis from the command line, you start an application called com.ibm.xtools.analysis.AnalyzeApplication using the -application option of eclipse.exe. This invocation runs a headless Eclipse environment with only the core features needed to run code reviews. AnalyzeApplication takes several options that specify the scope of the analysis, the location of the source code, the rules to apply, and the location of the analysis results. The application can also write analysis results to stdout.
If you are working in a Microsoft® Windows® operating system, be aware that there is a limit to the number of characters that you can use for command line instructions. The following suggestions can help you reduce the length of a command line instruction:
You cannot run a code review in headless mode while the product graphical user interface has the workspace open and locked. If you have Java source code that is not in an Eclipse workspace, you can run a code review on the code and create a worskpace at the same time.
eclipse.exe -data C:\workspace-rsa-en -application com.ibm.xtools.analysis.commandline.AnalyzeApplication -rulefile c:\rules\commlinecoderev.dat -projects hello.world -exportdirectory c:\results -verbose
The following command line instruction runs a code review on Java source code in a directory location that is not an Eclipse workspace. It places the results of the code review in XML and HTML formats in a directory called c:\reports.
c:\ibmj9_50\jre\bin\java.exe -cp C:\progra~1\IBM\SDP70\startup.jar org.eclipse.core.launcher.Main -data c:\new-workspace -application com.ibm.xtools.analysis.commandline.AnalyzeApplication -rulefile c:\rules\commlinecoderev.dat -directory c:\project\src -exportdirectory c:\results -verbose