为什么 Intellij-IDEA 会忽略我的 tomcat/conf/server.xml 上下文标签? [英] Why does Intellij-IDEA ignore my tomcat/conf/server.xml Context tag?

查看:33
本文介绍了为什么 Intellij-IDEA 会忽略我的 tomcat/conf/server.xml 上下文标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 $TOMCAT_HOME/conf/server.xml 中,我把它放在底部附近:

In my $TOMCAT_HOME/conf/server.xml I put this near the bottom:

...

 <Context path="/staticdir" docBase="/filesystem/path/to/static/dir"/>                                

      </Host>
    </Engine>
  </Service>
</Server>

我这样做是因为我的文件系统上有文件,我希望当您访问 localhost:8080/staticdir 时,tomcat 可以提供这些文件

I'm doing this because I have files on my filesystem that I want tomcat to serve up when you go to localhost:8080/staticdir

但是当我在 Intellij-IDEA 中启动应用程序时,tomcat 日志显示:

But when I start the application in Intellij-IDEA the tomcat log says this:

使用 CATALINA_BASE: "C:Usersme.IntelliJIdea11system omcatUnnamed_Product_2"

Using CATALINA_BASE: "C:Usersme.IntelliJIdea11system omcatUnnamed_Product_2"

如果我进入我文件系统上的那个目录并查看 conf/server.xml 文件,它没有我放在那里的 Context 标签.为什么 Intellij 会修改它,我该如何防止它?

If I go into that directory on my filesystem and look at the conf/server.xml file, it doesn't have the Context tag I put in there. Why is intellij modifying this and how can I prevent it?

我觉得我应该对我的 $TOMCAT_HOME/conf/context.xml 文件进行此更改,但我无法在其中找到如何进行此更改的示例.如果有人可以向我展示一个示例,我会将其视为一个答案,因为我注意到 intellij 不会修改该文件.

I have a feeling I should have made this change to my $TOMCAT_HOME/conf/context.xml file instead, but I'm having trouble finding examples of how to make this change in there. If someone could show me an example of that, I'd consider it an answer, because I notice that intellij doesn't modify that file.

我找到了解决方法.

但我真的不喜欢这样,因为当新用户第一次尝试运行该应用程序时,我无法想象一种方法来检测他们是否错误地执行了这一步.

But I really don't like this because when new users try to run the app for the first time, I can't imagine a way to detect they did this step incorrectly.

这是我的tomcat配置图片:

Here's a picture of my tomcat configuration:

推荐答案

默认情况下 IntelliJ IDEA 会修改 CATALINA_BASE 环境,以便 Tomcat 使用调整后的配置文件直接从工件输出位置部署应用程序,但是它是可以覆盖此行为并手动配置所有内容(通过将工件输出更改为进入 webapps 或以与 IDEA 相同的方式更改服务器配置,以便从标准工件输出进行部署).

By default IntelliJ IDEA modifies CATALINA_BASE environment so that Tomcat uses adjusted configuration files for deploying applications directly from the artifact output location, however it's possible to override this behavior and configure everything manually (either by changing the artifact output to go into webapps or by changing the server configuration in the same way IDEA does so that deployment occurs from the standard artifact output).

这篇关于为什么 Intellij-IDEA 会忽略我的 tomcat/conf/server.xml 上下文标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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