2

I am writing a TeamCity plugin and I'm trying to figure out what the best place to put a .properties file would be. I was under the impression that the data/config dir would be on the CLASSPATH, but this doesn't seem to be the case.

Could somebody please give me some examples of existing plugins which are configurable via a .properties file on the file system and how this all should work?

Many thanks in advance!

carlspring
  • 31,231
  • 29
  • 115
  • 197

1 Answers1

1

You can inject a @NotNull ServerPaths serverPaths (see Javadoc) as a parameter to your constructor. Then you can do:

File propertiesFile = new File(serverPaths.getConfigDir() + "/my-plugin.properties");

... and then load up the properties file using a FileInputStream.

carlspring
  • 31,231
  • 29
  • 115
  • 197