Define the Hudson/Jenkins Job to run in build definition programtically

IBuildDefinition definitionWC = (IBuildDefinition)definition.getWorkingCopy();
definition.setConfigurationProperty(HudsonConfigurationElement.ELEMENT_ID, HudsonConfigurationElement.PROPERTY_HUDSON_JOB, "<Jenkins Job Name>");
definitionWC = buildClient.save(definitionWC, new NullProgressMonitor());
Liora
Accepted answer

IBuildDefinition definitionWC = (IBuildDefinition)definition.getWorkingCopy();definition.setConfigurationProperty(HudsonConfigurationElement.ELEMENT_ID, HudsonConfigurationElement.PROPERTY_HUDSON_JOB, "<jenkins Job="" Name="">");
definitionWC = buildClient.save(definitionWC, new NullProgressMonitor());
It should be definitionWC.setConfigurationProperty() and not definition.setConfigurationProperty()
Thanks,
Sridevi
2 other answers

.....BUT, it is not working.... is not a whole lot of information, really
Comments

Ralph, Considered already :-)

Hi Liora,
Can you try this definition.setConfigurationProperty(HudsonConfigurationElement.ELEMENT_ID, HudsonConfigurationElement.PROPERTY_HUDSON_JOB, "<job name>");
Replace the <job name> with the name of the jenkins job.

Right. I used the code as you specified.

What does "does not work" mean? What errors, what issues in the debugger? See https://jazz.net/forum/questions/203755/how-should-i-ask-a-question-in-the-forum-if-i-want-to-receive-useful-answers for information you should provide.

Exception in thread "main" com.ibm.team.repository.common.internal.ImmutablePropertyException
at com.ibm.team.repository.common.internal.util.ItemUtil$ProtectAdapter.notifyChanged(ItemUtil.java:2143)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
at com.ibm.team.build.internal.common.model.impl.ConfigurationPropertyImpl.setValue(ConfigurationPropertyImpl.java:204)
at com.ibm.team.build.internal.common.model.impl.BuildDefinitionImpl.setConfigurationProperty(BuildDefinitionImpl.java:1345)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.ibm.team.repository.common.internal.util.ItemStore$ItemInvocationHandler.invoke(ItemStore.java:597)
at com.sun.proxy.$Proxy20.setConfigurationProperty(Unknown Source)
at BuildDefinitionUtils.CreateBuildDefinition(BuildDefinitionUtils.java:41)
at RTCBuild.main(RTCBuild.java:30)