Can the rtc workspace be changed in a builddef using the java api
I can retrieve the builddef and its elements but I can find the workspace properties for the Jazz source control element.
|
2 answers
K M,
the trick is to import com.ibm.team.build.internal.common.builddefinition.IJazzScmConfigurationElement;Then get your build definition: IBuildDefinition buildDef = ClientFactory.getTeamBuildClient(teamRepository).getBuildDefinition(buildDefId, null); read the Build workspace property: String wsUUID = buildDef.getConfigurationPropertyValue(IJazzScmConfigurationElement.ELEMENT_ID, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, null); If this returns the default value (null in this example) it was not set. You might have to create the SCM configuration element if that is also not present yet. To change workspace property to a new String workspaceUUID, get a working copy of buildDef, set the property and save: IBuildDefinition copyBuildDef = (IBuildDefinition) buildDef.getWorkingCopy(); copyBuildDef.setConfigurationProperty(IJazzScmConfigurationElement.ELEMENT_ID,IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, workspaceUUID); copyBuildDef = ClientFactory.getTeamBuildClient(repo).save(copyBuildDef, null); If this answers your question, please mark the answer as accepted. Best, Arne Comments
K M
commented May 07 '15, 11:05 a.m.
that does the trick, the next question is how to change the Post-build Deliver element properties
K M
commented May 07 '15, 11:05 a.m.
that does the trick, the next question is how to change the Post-build Deliver element properties
K M
commented May 07 '15, 12:50 p.m.
I can use
|
Even if this is an old question, maybe somebody may find something similar to what I get, that is a bit different from the answer I read here.
I'm using RTC 4.0.7.
If I use getConfigurationPropertyValue I don't get the right property value, while everything works if I use directly getProperty.
I mean
String wrongResult = buildDefinition.getConfigurationPropertyValue(IJazzScmConfigurationElement.ELEMENT_ID, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, null);
gives back "null" while
IBuildProperty rightResult = buildDefinition.getProperty(IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID);
gives back a correct build property from which I may get name and value (getValue() and getName())
In particular if I want to investigate all the "IBuildConfigurationElement" of a Build definition I get a strange result.
With this code:
List<IBuildConfigurationElement> buildConfigurationElements = buildDefinition.getConfigurationElements();
I get this output:
+buildDefinitionn id==Build_CD_WEB_XCD_Copy== buildConfigurationElementt id==com.ibm.team.build.general== name ==General== +buildDefinitionn id==Build_CD_WEB_XCD_Copy== buildConfigurationElementt id==com.ibm.team.build.schedule== name ==Schedule== +buildDefinitionn id==Build_CD_WEB_XCD_Copy== buildConfigurationElementt id==com.ibm.team.build.properties== name ==Properties== +buildDefinitionn id==Build_CD_WEB_XCD_Copy== buildConfigurationElementt id==com.ibm.team.build.jazzscm== name ==Jazz Source Control== --configurationProperty name ==com.ibm.team.build.engine.variable.substitution== value==== +buildDefinitionn id==Build_CD_WEB_XCD_Copy== buildConfigurationElementt id==com.ibm.team.build.ant== name ==Ant== --configurationProperty name ==com.ibm.team.build.ant.buildFile== value==D:\C:\BUILD\ANT\dummy.xml== --configurationProperty name ==com.ibm.team.build.ant.targets== value==== --configurationProperty name ==com.ibm.team.build.ant.antArgs== value==-v -d== --configurationProperty name ==com.ibm.team.build.ant.antHome== value==== --configurationProperty name ==com.ibm.team.build.ant.javaHome== value==== --configurationProperty name ==com.ibm.team.build.ant.javaVMArgs== value==== --configurationProperty name ==com.ibm.team.build.ant.workingDir== value==${destDir}== --configurationProperty name ==com.ibm.team.build.ant.propertiesFile== value==${destDir}/fromRTC.properties== --configurationProperty name ==com.ibm.team.build.ant.includeToolkit== value==true== --configurationProperty name ==com.ibm.team.build.engine.variable.substitution== value====
so it seems to me that only "com.ibm.team.build.ant" aka "IAntConfigurationElement.ELEMENT_ID" has a structure for getting IBuildConfigurationElement
Comments Notice that this behavior is similar to what is written in Nick Edgar comment about "SCM workspace UUID" here: https://jazz.net/forum/questions/140583/copy-build-definition-error-help/140696 |
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.