How can I invoke MainConfigProcesser writeTo on my Class?

I want to store settings from within my controller. The controller has a refrence to my Configuration-Class which implements MainConfigProcessor.

How can I invoke writeTo() programmatically? Where do I get the "serverConfigRoot" Element from?

When clicking on save on the general settings page, my Configuration-Classes callback is called. However, I want to explicitely store the preferences from within my controller.configurations plugins

Comment actions Permalink

BTW: The documentation in the TeamCity Documentation is outdated:

  • Server-wide settings
    • Please support an example when MainConfigProcessor#writeTo() is called
    • JavaDoc for MainConfigProcessor doesn't explain anything, neither
  • Project-wide settings
    • ProjectManager#persistAllProjects isn't available anymore
Comment actions Permalink

The simplest way currently is to store your plugin settings in separate file. You can use ServerPaths object to obtain path to configuration directory. Then you can create a file there for your plugin settings.
At the moment TeamCity does not have special API for custom settings.

Comment actions Permalink

Hi Pavel,

thank you for your answer. I will use your suggested way and create a new configuration file.

However, I think this should be changed in the documentation, because it is misleading.


Please sign in to leave a comment.