Could not save the copied build engine using RTC java api
Dear Team,
I am trying to create a build engine in RTC by using java api. I use the method ".copyEngine()", but the new build engine is failed to save. The error message mentions that the item which I am trying to save could not be found from RTC database.
Could you give me some advice?
Thank you very much!
My code is simple as below:
===================================
String originalBuildId = "CI_BF_Agent_NO.2";
IBuildEngine originalBuildEngine = (IBuildEngine) cbe.getBuildEngine(originalBuildId).getWorkingCopy();
//IBuildEngine newEngine = BuildItemFactory.createBuildEngine();
IBuildEngine newEngine = originalBuildEngine.copyEngine();
newEngine.setId("R_CI_BF_Agent_NO.2");
newEngine.setActive(true);
newEngine.setProcessArea(originalBuildEngine.getProcessArea());
buildClient.save(newEngine, null);
===========================
2 answers
Richar,
please check
https://jazz.net/forum/questions/151314/how-to-edit-jenkins-url-on-build-engine-using-java-api
also all the comments. I believe the key might be to fetch the complete refreshed engine before copying:
buildEngine = (IBuildEngine) getTeamRepository().itemManager()
.fetchCompleteItem(buildEngine, IItemManager.REFRESH, null);
If this helps please mark the answer as accepted,
- Arne
please check
https://jazz.net/forum/questions/151314/how-to-edit-jenkins-url-on-build-engine-using-java-api
also all the comments. I believe the key might be to fetch the complete refreshed engine before copying:
buildEngine = (IBuildEngine) getTeamRepository().itemManager()
.fetchCompleteItem(buildEngine, IItemManager.REFRESH, null);
If this helps please mark the answer as accepted,
- Arne
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jun 01 '16, 3:02 a.m.Richar Cai
Jun 04 '16, 3:51 a.m.