It's all about the answers!

Ask a question

How to get/set the workspace in Build Definition via SDK API


Jia Jia Li (8057152192) | asked May 31 '12, 10:51 a.m.
Hi,

Is there any one know how to get/set the workspace if I get the builddefiniton.

Thanks!

ITeamBuildClient buildClient = (ITeamBuildClient) repo.getClientLibrary(ITeamBuildClient.class);


IBuildDefinition buildDef = buildClient.getBuildDefinition(buildDefininionName, monitor);

//modify the name
buildDef = (IBuildDefinition)buildDef.getWorkingCopy();
buildDef.setId("aa");


This is the code to rename a definition id, how to reset a workspace?

Thanks!

Accepted answer


permanent link
Nick Edgar (6.5k711) | answered Jun 13 '12, 2:58 p.m.
JAZZ DEVELOPER
Assuming the build definition was created with the Jazz SCM pre-build option, you can set the workspace property using:
com.ibm.team.build.common.model.IBuildDefinition.setProperty(String, String)
giving:
com.ibm.team.build.internal.common.builddefinition.IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID
as the property name, and the workspace item id as the value:
aWorkpace.getItemId().getUuidValue()


Jia Jia Li selected this answer as the correct answer

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.