开发者

Running Tomcat as application in intellij IDEA community edition

I'm trying to setup an old website in intellij IDEA. I have all the source code and necessary configuration files for the old project. Have setup source code and web content in intellij and it compiles. I can't really figure out how to start the application though. I found a post describing how to do this using the "bootstrap class" in Tomcat. I can start my server using this technique but my application is not deployed 开发者_如何学Pythonautomatically inside Tomcat.

Is there a way I can specify something like a dynamic webapp-directory when starting Tomcat using the bootstrap class? I know I can configure Tomcat to look for an application in the webcontent folder of my project but that kind of seems like the wrong way to go, eg if I change the location of my project, it wont work.

So my question is: Is there a way I can tell the bootstrap class to "include" my web application root directory, which would be the web content folder residing inside my project folder.


Yes, you can use the context in server.xml file (you find it in tomcat/conf)

Add a line like this as child to the Host tag in server.xml:

<Context path="myapp" docBase="d:\work\workspace\projectfolder\target\cougar-app-web-common-0.0.2-SNAPSHOT.war" />

if you use a war OR

<Context path="myapp" docBase="d:\work\workspace\projectfolder\target\web" />

if would like to use the expanded version.

This basically tells Tomcat to take the "myapp" application from that folder rather than the default webapps folder.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜