问题
When running dist task, distribution package includes conf files (from <app>/conf
) in two places:
<app.zip>/conf
<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 -
- Go to app build folder.
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