Play dist task: how to prevent conf files to be packed

ぐ巨炮叔叔 提交于 2019-12-24 16:13:06

问题


When running dist task, distribution package includes conf files (from <app>/conf) in two places:

  1. <app.zip>/conf
  2. <app.zip>/lib/<app.jar>

This means that application.conf (and all the other conf files whithin <app>/conf) will be placed both in the root of the zip package, and in the root of the main jar library. When running the application, files inside jar are the ones used, so copies in the <unzipped-app>/conf are completely ignored.

I'm wondering which is the best practice here: I think conf files should not be packed inside the <app> jar (may be some expression on build.sbt to keep them out?), but available in the distribution zip file. So, when unzipped and deployed, conf files can be modified as needed.

resourceDirectory seems to point to baseDirectory/'conf/', is this key the one that should be explicitely excluded form packageBin task?


回答1:


You can add your conf file in the following way -

  1. Go to app build folder.
  2. Type the following command -

    java -Dapplication.secret="mySecretKey" -Dconfig.resource=conf/application.conf -cp "lib/*;" play.core.server.NettyServer .



来源:https://stackoverflow.com/questions/32320749/play-dist-task-how-to-prevent-conf-files-to-be-packed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!