It's all about the answers!

Ask a question

How to create build definition programmatically?


Akshay Daga (134) | asked Aug 25 '21, 4:27 a.m.

 I want to automate the process of creation of build definition in RTC.

3 answers



permanent link
Luca Martinucci (1.0k294112) | answered Aug 25 '21, 5:36 a.m.

I suggest that you give some more details about your request, but I have a sample that uses Plain Java API.


import com.ibm.team.build.common.BuildItemFactory;
import com.ibm.team.build.common.builddefinition.BuildConfigurationRegistry;
import com.ibm.team.build.common.builddefinition.IBuildDefinitionTemplate;
// create build definition
IBuildDefinition newbuildDef = BuildItemFactory.createBuildDefinition((com.ibm.team.process.common.IProcessArea) projectArea);

Once you have the IBuildDefinition object, you can set its properties using the BuildItemFactory methods. 


permanent link
Kenny Smith (302513) | answered Aug 25 '21, 9:32 a.m.

 The easiest is to use ANT to create the build definitions.


Here is an example:

<project name="BuildServer"
         xmlns:ld="antlib:com.ibm.team.enterprise.zos.systemdefinition.toolkit"
         xmlns:xt="antlib:com.ibm.team.build.extensions.toolkit">
.......
<xt:updatebuilddefinition buildworkspace="build.mortgage.test"
                          repositoryAddress="${repo.url}"
                          userId="${repo.adminid}"
                          password="${repo.adminpw}"
                          buildid="mortgage.test"
                          processareaname="${jke}"
                          processAreaNameDefinitions="${zproject.name}"
                          updateOnly="true"
                          verbose="true"
                          failOnError="true">
<xt:buildEngineDefine id="zos.my.co" />
</xt:updatebuilddefinition>
........
</project>


permanent link
Justin McGee (111) | answered Aug 26 '21, 1:16 a.m.
edited Aug 27 '21, 2:20 a.m. by Ralph Schoon (62.9k33645)

 The easiest is to use ANT to create the build definitions.


Here is an example:

<project name="BuildServer"
         xmlns:ld="antlib:com.ibm.team.enterprise.zos.systemdefinition.toolkit"
         xmlns:xt="antlib:com.ibm.team.build.extensions.toolkit">
.......
<xt:updatebuilddefinition buildworkspace="build.mortgage.test"
                          repositoryAddress="${repo.url}"
                          userId="${repo.adminid}"
                          password="${repo.adminpw}"
                          buildid="mortgage.test"
                          processareaname="${jke}"
                          processAreaNameDefinitions="${zproject.name}"
                          updateOnly="true"
                          verbose="true"
                          failOnError="true">
<xt:buildEngineDefine id="zos.my.co" />
</xt:updatebuilddefinition>
........
Myloweslife
</project>

Thanks for the update and quick reply. I'll be sure to keep an eye on this thread. Looking for the same issue. the solution worked for me.

Your answer


Register or to post your answer.