It's all about the answers!

Ask a question

RTC Build using build forge through the plain java api (SDK)


sam matthews (434) | asked Oct 11 '13, 5:47 a.m.
My question is related to doing a build in RTC using Build forge through the plain java api (SDK) as shown in the link below

https://jazz.net/wiki/bin/view/Main/BuildJavaProgrammingExamples

Is there a way to pass in properties using the API that have been defined in build forge / the build definition ( they would usually be passed in through the build request in the RTC client ).

Please let me know if you need any more info



2 answers



permanent link
Spencer Murata (2.3k115971) | answered Oct 11 '13, 3:35 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
 Use the IBuildRequest to get to the BuildDefinitionInstance or directly get the properties via getBuildDefinitionProperties() and then you can do a get on the property and set the value to whatever you want.

~Spencer

Comments
sam matthews commented Oct 14 '13, 6:25 a.m.

Hi Spencer


Thanks for the reply. Can you please include an example? the documention on how to use this API / the java docs are very basic.

here is what i have so far to get the build request and do the build

 ITeamBuildClient buildClient = (ITeamBuildClient) teamRepository.getClientLibrary(ITeamBuildClient.class);
IBuildDefinition buildDefinition = buildClient.getBuildDefinition(buildDefinitionId, monitor);
ITeamBuildRequestClient requestClient = (ITeamBuildRequestClient) teamRepository.getClientLibrary(ITeamBuildRequestClient.class);
IBuildRequest buildRequest = requestClient.requestBuild(buildDefinition, true, monitor);


permanent link
sam matthews (434) | answered Oct 14 '13, 10:59 a.m.
SOULTION 

ITeamBuildClient buildClient = (ITeamBuildClient) teamRepository.getClientLibrary(ITeamBuildClient.class);
IBuildDefinition buildDefinition = buildClient.getBuildDefinition(buildDefinitionId, monitor);

IBuildDefinition buildDefinitionWorking = (IBuildDefinition) buildDefinition.getWorkingCopy();
ITeamBuildRequestClient requestClient = (ITeamBuildRequestClient) teamRepository.getClientLibrary(ITeamBuildRequestClient.class);

buildDefinitionWorking.setProperty("release-env", "aaa");
requestClient.save(buildDefinitionWorking, monitor);

IBuildRequest buildRequest = requestClient.requestBuild(buildDefinitionWorking, true, monitor);
return buildRequest; 

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.