Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to create Build Definition via SDK API?

Hi,
I need to batch set the i project mapping for IBM i build definition via API.

Can any one provide the sample of create build definition.

I read the source code of create build definition wizard, it needs build template, if I create via API, does the template needed?

Thanks!

0 votes


Accepted answer

Permanent link
I got the cause, since the processAreaHandle is null in my code.
If set the para right, the definition created correctly.

Thanks!
Ralph Schoon selected this answer as the correct answer

0 votes


One other answer

Permanent link
I find the following code in SDK test jar, but run with expection, any one can help?
String templateId = "com.ibm.team.build.ant";
	  private static IBuildDefinition createBuildDefinition(ITeamRepository repo, IProcessAreaHandle processAreaHandle, String templateId, String definitionId) throws Exception {

IBuildDefinition definition = null;
IBuildDefinitionTemplate template = BuildConfigurationRegistry.getInstance().getBuildDefinitionTemplate(templateId);
if (template != null) {
definition = BuildItemFactory.createBuildDefinition();
definition.setProcessArea(processAreaHandle);
definition.setId(definitionId);
definition.initializeConfiguration(template);
definition = ClientFactory.getTeamBuildClient(repo).save(definition, new NullProgressMonitor());
}
return definition;
}


java.lang.IllegalArgumentException: Item Handle must not be null
at com.ibm.team.repository.service.internal.RepositoryItemService.fetchItem(RepositoryItemService.java:493)
at sun.reflect.GeneratedMethodAccessor276.invoke(null)

Thanks!

3 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: May 31 '12, 3:39 a.m.

Question was seen: 4,489 times

Last updated: May 31 '12, 3:39 a.m.

Confirmation Cancel Confirm