You can run code reviews in a "headless" workbench (with no user
interface for the development environment) from a command line interface.
The code review rules that run on the source code are the ones that were last
used in the user interface. If a code review has never been run, the default
settings in the Java™ preferences – Code Review page (the Quick code
review) run on the code. By default, after the code review runs, two reports
are generated: an HTML report and a JSML (JScrib Markup Language) report.
They are located in the metadata folder of the workspace in the com.ibm.r2a.command.line.mode
folder. You can specify which type of report is generated and the location
in which the reports appear after the code review runs.
Note: You can run code reviews in headless mode only on the workspace.
If you want to analyze a subset of the workspace, such as one or more specific
projects, create a workspace with these projects and run the code review on
this workspace.
Before running code reviews in headless mode:
- The workspace must contain at least one project with Java source
files.
- If you want to specify the rules that run, you must configure the code
review in the user interface.
The development environment does not need to be running.
You cannot
run several executions of code review in headless mode on the same workspace
at the same time, nor can you use headless mode while an Eclipse graphical
user interface has locked the workspace.
Note: Because of Windows
® operating
system limitations, the length of the string that is used to run the command
line mode (C:\path\java.exe …) must be as short as possible, or the parameters
at the end of the string could be cut and lost by the system. Windows users
should use the following best practices for optimal results:
- The PATH variable should include as many paths as possible, for example,
the Java path
and the path to the JAR files.
- The path to the workspace should be as short as possible, for example,
C:\workspace.
- The path to the location where reports are generated should also be as
short as possible, for example, C:\report.
To run code reviews in a headless workbench, you launch the
command line mode application using the command
<eclipse_dir>/jre/bin/java <virtual
machine options> -cp <eclipse_dir>/startup.jar
org.eclipse.core.launcher.Main <command line mode options> <eclipse
options>, along with your product configuration. You
can find your product configuration at .
<virtual
machine options> are located under the
eclipse.vmargs property.
The main Eclipse options are located under the
eclipse.commands property,
to which you add the workspace path using the Eclipse token
-data.
<command
line mode options> refers to command-line mode options.
Note: You
might need to append additional parameters to the commands in the following
steps, depending on your operating system configuration. The parameters are
located in the system configuration details under "System properties".