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

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

问题描述

在我的$ 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>

我这样做是因为我的文件系统上有文件我希望tomcat在你提供服务时转到localhost:8080 / staticdir

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:\Users\me.IntelliJIdea11 \ system \ tomcat \Unnamed_Product_2

Using CATALINA_BASE: "C:\Users\me.IntelliJIdea11\system\tomcat\Unnamed_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.

我找到了一个解决方法。

I have found a workaround.

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

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 Context标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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