在 Tomcat/Catalina Context docBase 配置中使用环境变量
我不是tomcat的大用户,但我们的项目目前正在使用它。我们已经提交了一个 .xml 配置文件,该文件放置在 CATALINA_HOME\localhost 中,但更新得相当频繁。我更愿意将此文件从我们的工作目录符号链接到 CATALINA_HOME\localhost 目录中。不幸的是,每个开发人员都必须修改 docBase 路径。
有没有办法在 docBase 路径中使用环境变量,以便开发人员可以将他们的项目保留在他们喜欢的位置,并且我们的启动脚本可以符号链接 catalina xml 配置?
我想要这样的东西:
....
I'm not a big tomcat user, but our project is using it currently. We've committed a .xml configuration file that is placed in CATALINA_HOME\localhost, but get's updated rather often. I would much prefer to symlink this file into that CATALINA_HOME\localhost directory from our working directory. Unfortunately, the docBase path has to be modified per developer.
Is there a way to use environment variables in the docBase path so that developers can keep their projects where they please and our startup scripts can symlink the catalina xml configuration?
I would like something like this:
....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我在 Tomcat7 中所做的(我认为在 Tomcat 的其他版本中执行此操作不会有任何问题):
在 setenv.bat 中,我添加了以下行:
在我的 webapp.xml 中(位于 C:\path-to-apache 中) -tomcat\conf\Catalina\localhost)
我做了以下操作:
希望这有帮助!
Here's what I did in Tomcat7 (I think you'll have no problem doing it in other versions of Tomcat):
in setenv.bat I added the following line:
in my webapp.xml (located in C:\path-to-apache-tomcat\conf\Catalina\localhost)
I did the following:
Hope this helps!