It's all about the answers!

Ask a question

Copy Build Definition error, help


sam detweiler (12.5k6184201) | asked Jan 30 '14, 4:06 p.m.
edited Jan 31 '14, 12:15 p.m. by Nick Edgar (6.5k711)
 my project copy utility has run into a problem.  Apparently I don't copy something from a build definition..

we get this error

2014-01-30 08:24:05 [Jazz build engine] 
com.ibm.team.build.common.TeamBuildException: Request for build "SME.Trunk.Build.UI.Nightly" does not include a configuration element for the BUILD phase. The Jazz build engine does not support a generic build definition with no builder.

I copied every element. and every property.. what did I miss?  I do NOT 'initialize' the new builddef. 
I do not know what template was originally selected 

IBuildDefinition newbuildDef = BuildItemFactory.createBuildDefinition((IProcessArea) new_project);
for (IBuildConfigurationElement buildConfElem : (List<IBuildConfigurationElement>) oldbuildDef.getConfigurationElements())
{
                IBuildConfigurationElement newconfElem = BuildItemFactory.createBuildConfigurationElement();
                // then copy its properties
                for (IConfigurationProperty buildConfigProperty : (List<IConfigurationProperty>) buildConfElem.getConfigurationProperties())
                {
                }
}
// then copy the build properties
    for (IBuildProperty bdp : (List<IBuildProperty>) oldbuildDef.getProperties())
{
}
then save the thing
 newbuildDef = buildClientdev.save(newbuildDef, null);

One answer



permanent link
Nick Edgar (6.5k711) | answered Jan 31 '14, 12:15 p.m.
JAZZ DEVELOPER
Hi Sam. The code above doesn't show the copied config elements or properties getting added to the new definition.  Maybe that was just filtered out by the forum. You also need to set an id and owning process area on it (you must be doing so already, or it wouldn't save).  Another option is to use IBuildDefinition.copyDefinition() and then replace the properties that differ, e.g. set the copied process area.

Comments
sam detweiler commented Jan 31 '14, 12:24 p.m.

thanks.. I didn't include all the code.. I see now copyDefinition().. but

I am concerned that there are internal data items (handles) that don't map between different servers..  I have to remap the workspace and component UUIDs already..

I don't want 'anything' different.. except for the UUID based properties...


1
Nick Edgar commented Jan 31 '14, 12:35 p.m. | edited Jan 31 '14, 12:35 p.m.
JAZZ DEVELOPER

Things you need to map include:

- definition id (if there could be a conflict with an existing one)
- owning process area
- SCM workspace UUID (if definition uses Jazz SCM)
  - stored as a regular build property (not a config element property), with prop name available as constant:
com.ibm.team.build.internal.common.builddefinition.IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID
- supporting build engines (actually stored the other way around: build engine has list of supported definitions)

There may be more, depending on the type of build.

Are you copying builds themselves too, or just the definitions/engines?  Builds and their contributions can have lots of refs to other items.

Your answer


Register or to post your answer.