Code review headless mode reference

Headless mode allows you to automate code reviews from a command line or Ant script without user input and without the product graphical user interface.

Purpose

The command line launches a "headless" workbench (with no user interface for the development environment) and runs code review launch configurations that are found in a specified workspace.

This is the basic command line syntax to run a code review in headless mode:

<Eclipse directory>/jre/bin/java <mandatory parameters> <optional parameters>

Mandatory parameters

There are three categories of mandatory parameters:
  • Product VM
  • Eclipse
  • Command line

Product VM

-Xj9
Launches the application for command-line mode, along with other parameters listed under Help > About Eclipse Platform > Configuration Details.
-cp <classpath>/startup.jar org.eclipse.core.launcher.Main
Launches Eclipse in headless mode with the specified class path. Use double quotes when the path contains spaces.
For Windows, use double backslashes (\\) instead of the backslash character. Here is an example: "C:\\Program Files\\IBM\\Rational\\".
Eclipse
-plugincustomization <pluginCustomizationPath>
Replaces the customization path for the plug-in with the path of the pluginCustomization.ini file for your plug-in.
-application com.ibm.r2a.command.line.mode.CommandLineModeApplication
Specifies the application used for running the code review.
-data <workspace>
Specifies the location of the workspace where the launch configurations are located. Use double quotes when the path contains spaces. For Windows, use double backslashes (\\) instead of the backslash character. Here is an example: "C:\\Program Files\\IBM\\Rational\\".
-os linux
Specifies Linux as the operating system. This parameter comes from the Help > Configuration Details > System properties > Eclipse commands section.
-ws gtk
Specifies the user interface configuration parameter required by some Eclipse components. This parameter comes from the Help > Configuration Details > System properties > Eclipse commands section.
Command line
-reportDirectory directory_path
Specifies the directory where report files are to be produced. Use double quotes when the path contains spaces. For Windows, use double backslashes (\\) instead of the backslash character. Here is an example: "C:\\Program Files\\IBM\\Rational\\".

Optional parameters

-persistKind html|xml
Specifies whether to produce either an HTML or XML report alone. By default, both reports are generated.
-verbose
Produces a simple output of states for debugging purposes only.
-excludeClient
Specifies one or more clients, by name, to exclude from the code review.
-onlyClient
Specifies to run only one client by name; by default, all the clients run.
-reportDirectory
Specifies the report directory into which the generated reports are placed after the code review; the default report directory is in the metadata of the command line plug-in.
-timeStampMode
Specifies the directory into which the generated reports are placed after the code review, and applies a time stamp to the report.

Sample

This sample Ant script silently runs all the launch configurations that are located in D:\workspace and produces the results in a directory named batch_report located in the workspace.
<?xml version="1.0" encoding="UTF-8">
<project name="MyTestProject" default="CodeReviewHeadless" >

	<target name="CodeReviewHeadless">

		<property name="eclipse_dir" value="D:\\eclipse"/>
		<property name="workspace_dir" value="D:\\workspace"/>
		<property name="options" value=" -plugincustomization <pluginCustomizationPath> -onlyClient CodeReview -reportDirectory ${workspace_dir}\\batch_report -timeStampMode"/>

		<exec executable="${eclipse_dir}/jre/bin/java" dir="${eclipse_dir}" vmlauncher="false">
			<arg line="-Xj9 -Dorg.eclipse.swt.browser.internal.flash -Dorg.eclipse.emf.ecore.EPackage.Registry.INSTANCE=org.eclipse.emf.ecore.impl.EPackageRegistryImpl -cp ${eclipse_dir}/startup.jar org.eclipse.core.launcher.Main -application com.ibm.r2a.command.line.mode.CommandLineModeApplication -data ${workspace_dir} ${options}" />
		</exec>
	</target>

</project>
Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.