It's all about the answers!

Ask a question

Changing a build definition with the Java API


Sola Otudeko (4511516) | asked Feb 24 '15, 12:54 p.m.
Hi. I'm writing a program to change a build definition trying to change a build def property (buildforge to jenkins).
Can anyone help with the error message (state id and item id)
Thanks.
regards
Sola

----------------------

buildClient = (ITeamBuildClient) this.teamRepository.getClientLibrary(ITeamBuildClient.class);

IBuildDefinition bd = buildClient.getBuildDefinition(bdName, rtc.getMonitor());
IBuildDefinition wc = (IBuildDefinition) bd.getWorkingCopy();
wc.setProperty("com.ibm.team.build.internal.template.id", "com.ibm.rational.connector.hudson.ui.buildDefinitionTemplate");
bd = buildClient.getBuildClient().save(bd, rtc.getMonitor());

throwing an exception for some missing values:

java.lang.IllegalArgumentException: Item id and State id must not be null

    at com.ibm.team.repository.service.internal.RepositoryItemService.fetchState(RepositoryItemService.java:695)
    at sun.reflect.GeneratedMethodAccessor430.invoke(null)



One answer



permanent link
Sola Otudeko (4511516) | answered Feb 24 '15, 1:05 p.m.
Sorry folks...spotted my mistake. sent the bdef instead of working copy to save.

Your answer


Register or to post your answer.