Builds: Continuous Integration
Please note that starting from codeBeamer 5, this feature is no longer supported, as our
Jenkins integration should be used instead.
Apache Ant build scripts are invoked by codeBeamer for manual builds or automated, periodic builds. Ant can also use different build systems such as Maven.
With New Build you can select Ant scripts with different targets and parameters for execution.
Before you can invoke an Ant script, it must exist in the project SCM repository. To invoke a new build script you must first create a build.xml file and put it into the project SCM repository.
When the build.xml is newly created in the SCM repository, you must synchronize the repository with the following steps:
- Click Admin
- Click SCM Setting
- Select your SCM system
- Set Synchronize and reparse the project now ON
- Click Saveyou want to launch Ant in a separate JVM build.xml will appear in the Ant Build Filecombo box, and then you can invoke it from codeBeamer.
It is important to understand that the build.xml (Apache Ant) script file will be checked out from the source code repository before execution. In order to use the latest build script file:
- the modifications from your working copy (from inside your development environment) must be committed to the repository and
- the source code from the appropriate codeBeamer project needs to be synchronized.
Figure: Creating a New Build.
You must login to see this link. Register now, if you have no user account yet.
There are several codeBeamer provided ANT tasks available to enhance your ANT scripts. For detailed documentation please refer to your manual.
CBRelease usage example:
<jar jarfile="jdiff.jar" basedir="builds" ></jar> <CBRelease file="jdiff.jar" ></CBRelease>
CBPost usage example:
<CBPost forumid="55" subject="Hello!" description="Hello world!" format="W" ></CBPost>
For detailed documentation of the CodeBeamer Ant tasks, please refer to your manual.
CBExportReport usage example:
<CBExportReport reportId="1007" type="excel" comments="true" fileName="/var/reports/recent.xls" ></CBExportReport>
Example: build.xmlAnt file.
<?xml version="1.0"?
<project name="Jdiff" default="main" basedir="."
<target name="main"
<mkdir dir="builds" ></mkdir>
<javac srcdir="csfactory" destdir="builds" ></javac>
<jar jarfile="jdiff.jar" basedir="builds" ></jar>
<delete file="jdiff-src.zip"></delete>
<zip zipfile="jdiff-src.zip" basedir="." excludes="builds/**,*.jar,*.zip"></zip>
<CBRelease description="Jdiff Jar" file="jdiff.jar" sccCommitMessage="built new jar" ></CBRelease>
<CBRelease description="Jdiff Zip" file="jdiff-src.zip" sccCommitMessage="built new zip" ></CBRelease>
</target
</project
Ant scripts can be automatically scheduled using the Periodic Process Timer. See /cb/wiki/8797#section-Periodic+Process+Timer. This allows scheduled build, test and release process automation. NOTE: CodeBeamer Ant Integration and customizationFigure: Build System with ANT Task
You must login to see this link. Register now, if you have no user account yet.
Builds can be integrated into the Document Manager: build deliverables and test reports can be copied into the Document Manager's folders using the <CBRelease> task.
Starting a Maven Build from Ant
A Maven process can be started from Ant by adding a <taskdef> for Maven: it has the main Java class com.werken.forehead.Forehead. This is the class which is executed from the script $MAVEN_HOME/bin/mvn.bat when starting Maven from the command line. To start Maven with a <taskdef> in Ant, the Maven classes must be on the classpath.
In the following build.xml file is an Ant sample script that starts a Maven build on a Windows machine. The basedir is the location of the Maven project file.
Figure: A build.xmlto Start a Maven Build
<project name="mavenfromant" default="test" basedir="."
<!-- Test maven start from ant. --
<echo message="Start: ${basedir}" ></echo>
<target name="test"
<exec executable="C:\Programs\maven\bin\mvn.bat"
<arg value="clean" ></arg>
<arg value="jar:install" ></arg>
</exec
</target
</project
Creating and Customizing Builds
To administer project builds:
- Open the target project and click on the Builds tab pane;
- Existing builds are listed;
- To create a new build press the New button (or you can select an existing build and skip the following steps).
- Define or edit the name for the new build in the Name text field and provide a description in the Description text area;
- Give a description of the Build;
- Edit the Ant Logging Level;
- Select an item for the Ant Build File combo box. This combo box contains the Statistical Build entry as well as all the Apache Ant build files that are found on the source code repository (such as Subversion or CVS). In the Ant Build File all source code files with the .xml extension will be shown;
- Edit the Ant Targets and Ant Properties properties. These will be passed directly to the Apache Ant at run time;
- Select "Enabled" to allow Ant Builds or if required, disable the build in the Status property;
- The Build Scheduler section can be used to configure when and how often the build should be executed. If Synchronization is selected, synchronization with the source code repository will be executed before the build script is started (thus the script will run on the latest source code);
- The Build Notification Forums section can be used to specify the forums where notifications are to be sent in case of successful or erroneous builds;
- In the Project Statistics and Metrics section, if the Update Project statistics and metrics after this build option is selected, project statistical and metrics information will be created after the build is finished. Please consider that this might be CPU intensive on the server side.
Remote Build- and Deploy Automation
This article describes an approach to implement automated build and deploy management. Although it shows the sample code in form of a Groovy script, the same principles apply to any programming language.