It's all about the answers!

Ask a question

How to create Build Definition via SDK API?


Jia Jia Li (8058157192) | asked May 31 '12, 3:39 a.m.
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!

Accepted answer


permanent link
Jia Jia Li (8058157192) | answered May 31 '12, 9:12 a.m.
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

One other answer



permanent link
Jia Jia Li (8058157192) | answered May 31 '12, 6:03 a.m.
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!

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.