【问题标题】:What's the correct place to put a properties file for a TeamCity plugin so that it could be easy editable?放置 TeamCity 插件的属性文件以便易于编辑的正确位置是什么?
【发布时间】:2015-02-03 16:43:42
【问题描述】:

我正在编写一个 TeamCity 插件,并试图找出放置 .properties 文件的最佳位置。我的印象是data/config 目录会在CLASSPATH 上,但事实并非如此。

谁能给我一些现有插件的例子,这些插件可以通过文件系统上的.properties 文件进行配置,以及这一切应该如何工作?

非常感谢!

【问题讨论】:

    标签: java teamcity teamcity-8.0


    【解决方案1】:

    您可以将@NotNull ServerPaths serverPaths(参见Javadoc)作为参数注入构造函数。然后你可以这样做:

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

    ...然后使用FileInputStream 加载属性文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-12
      • 2011-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-18
      • 1970-01-01
      相关资源
      最近更新 更多