将war文件部署到heroku中,包括其他文件 [英] Deploy war file to heroku including additional files

查看:123
本文介绍了将war文件部署到heroku中,包括其他文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 war 文件部署到 heroku ,并希望包含其他 properties 文件,如下所示:

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

使用Heroku CLI配置WAR部署

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

它成功部署了 war 文件,但是在扩展应用程序的任何子文件夹中我都找不到 app1.properties 文件。同时, war 存档中的所有其他文件都在其位置上,另外的 tomcat war -tracker 文件,仅此而已。我试图添加一些具有相同结果的 jar 文件:

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

问题:heroku在哪里包括其他文件?

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

这是 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


推荐答案

这些文件将添加到您的根目录中Heroku应用程序,不会放入扩展的应用程序目录中。

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

您可以通过运行 heroku run来验证您的Dynos中是否存在文件。 cat app1.properties 。如果要自己浏览文件系统,可以使用 heroku run bash 进行深入研究。

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.

编辑:
如果您需要文件的路径,则可以使用

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

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

这篇关于将war文件部署到heroku中,包括其他文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆