Build Monitor

Build Monitor monitor will monitor your build for errors and warning coming from the compiler. These errors and warning are reported to Parasoft Concerto. There are two ways to utilize build monitor in ant. The first way is to configure build monitor in your ant build script. The second way is to set build monitor as a custom logger for ant.

Ant script configuration

The ant script configuration involves invoking the parasoft:monitor task before your project is compiled.

Example

<?xml version="1.0"?>
<project name="Parasoft Build" default="jtest" xmlns:parasoft="antlib:com.parasoft.antlib">
    <import file="build.xml"/> <-- import the original build script -->

    <target name="parasoft-init">
        <parasoft:monitor concertoHost="concerto.example.org"/> <!-- install the monitor -->
    </target>

    <target name="parasoft-build" depends="parasoft-init, compile"> <!-- compile is from the original build script -->
    </target>
</project>

Logger configuration

Logger configuration involves overridding the default ant logger to allow build monitor to run.

Setting Properties

Set all properties in the ANT_OPT environment variable so that the Ant script can detect all properties. See Available options for for options.

For Bash:

ANT_OPTS="-Dbuildmonitor.server.name=grsserver.example.com"

For Windows:

SET ANT_OPTS="-Dbuildmonitor.server.name=grsserver.example.com"

BuildMonitor Logger

The BuildMonitor Logger automatically detects the project name and project root from the Ant script.

Project Name

The project name must be set in the project node. If the project name is not defined in the option file or buildmonitor.projectroot, the application obtains the project name from the Ant script. BuildMonitor requires a name attribute from Ant. If Ant’s project node does not have a name, it will be set to "Default Project". Although Ant allows for this, it is not a recommended practice. All Ant project nodes require a set name attribute, for example

<project name="XXXX" basedir=".">
...
</project>
Project Root

When Ant contains multiple javac build tasks, it is difficult to set the project root. If this is the case, do not set the project root in the option file or -Dbuildmonitor.projectname. Javac tasks contain an src attribute and BuildMonitor will use the src value to set the project root.

Running Ant

You can run Ant with the following command, which overrides the default logger for Ant and triggers BuildMonitor to generate the build:

ant <user options> -logger proserve.tools.buildmon.BuildMonLogger
<build task command>

Available Options

CommandTask
buildmonitor.grs.server(Required) Sets Report Center server name.
buildmonitor.grs.port(Required) Sets Report Center server port. The default is set to: 32323.
buildmonitor.alternatelogger(Optional) Use to specify an alternate Ant BuildLogger for BuildMonitor to use, such as MailLogger. By default, BuildMonitor uses org.apache.tools.ant.DefaultLogger
Users can define their own loggers via typical passing of the -logger option to Ant, which is why BuildMonitor supports loggers aside from its own. 
By adding this property to the Ant command line, BuildMonitor loads the specified logger and uses it rather than the default logger, for example: 
buildmonitor.alternatelogger=org.apache.tools.ant.listener.MailLogger <with other options for MailLogger>
buildmonitor.attributes(Optional) Sets Concerto Report Center user attributes. The format should be as follows: 
name:value,name2:value2... 
For example: 
buildmonitor.attributes:ProjectName:buildmon,version:1.1 
buildmonitor.attributes:TestAttribute:test
buildmonitor.compiler(Optional) Name of the compile task. The javac Ant edition begins logging compile information during the task that is matched to the compiler. The default value for this option is javac.
buildmonitor.nightly(Optional) If set to true, "Nightly" is added as an attribute to the Test Group Properties Filter in Concerto Report Center. If left blank or set to false, it is not included as an attribute.
build.monitor.projectname(Optional) Name of the project, which is used for the Concerto Report Center project attribute. 
If property is not defined, BuildMonitor will pull the value from Ant’s $ant.project.name property setting.
buildmonitor.projectroot(Optional) Root path of the project. 
If the property is not defined, BuildMonitor will pull the value from Ant’s $basedir property setting.
buildmonitor.verbose(Optional) true means verbosity is on. false means verbosity is off. This command is only useful for debugging BuildMonitor issues. It provides more verbose output to the console so that you can see what is going on when BuildMonitor is executed.
eclipse.running(Optional) Set this system property if running Eclipse’s JAVAC compiler for javac task. Eclipse’s javac compiler prints warning and error messages in a different format—bypassing eclipse.running=true as the JVM argument (ANT_OPTS is the environment variable for the Ant script).