Dario
Dario

Reputation: 255

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

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?

Upvotes: 1

Views: 676

Answers (1)

Rakesh Chouhan
Rakesh Chouhan

Reputation: 1230

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 .

Upvotes: 1

Related Questions