I have a plugin that implements BuildServerListener and performs the task of automatically adding a build trigger whenever a new build configuration is created by implementing buildTypeRegistered() method. The trigger is added using SBuildType.addBuildTrigger() method by supplying a custom BuildTriggerDescriptor. Everything works fine here and i can see the newly added trigger from the UI. The problem happens when i try to make any modification to the build configuration after this, I am greeted with
java.lang.ClassCastException: "Class Name" cannot be cast to jetbrains.buildServer.buildTriggers.BuildTriggerDescriptorImpl"
Is there any way around this or is the API for adding a build trigger programatically not meant to be used?
I am using TeamCity Enterprise 6.5.4 (Evaluation license).