Search code examples
javaherokudeploymentwar

Deploy war file to heroku including additional files


I am deploying a war file to heroku and want to include additional properties file to the slug as described here:

Configuring WAR Deployment with the Heroku CLI

$ heroku war:deploy application.war --app awesomeapp --jdk 14 --includes app1.properties

It deploys war file successfully, but in any subfolder of the expanded application I can't find app1.properties file. At the same time all other files from war archive are on their places, additional tomcat war-tracker file, and nothing more. I tried to add some jar file with same result:

$ heroku war:deploy application.war --app awesomeapp --jdk 14 --includes app1.properties:some-lib.jar

Question: Where does heroku include additional files? How to get access there?

This is the output of the heroku-cli:

Uploading application.war
-----> Packaging application...
       - app: awesomeapp
       - including: app1.properties
       - including: some-lib.jar
       - including: webapp-runner.jar
       - including: application.war
-----> Creating build...
       - file: slug.tgz
       - size: 30MB
-----> Uploading build...
       - success
-----> Deploying...
remote:
remote: -----> heroku-deploy app detected
remote: -----> Installing JDK 14... done
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 96.9M
remote: -----> Launching...
remote:        Released v14
remote:        https://awesomeapp.herokuapp.com/ deployed to Heroku
remote:
-----> Done

Solution

  • Those files will be added to the root of your Heroku application and won't be put into the expanded application directory.

    You can verify your file is present in your Dynos by running heroku run "cat app1.properties". If you want to explore the file system yourself, heroku run bash allows you to delve though it.

    Edit: If you need a path to the file, you can construct one using

    String path = System.getProperty("user.home") + File.separator + "app1.properties";