1

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 automatically 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.

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Browsing through a bunch of old Questions I found your reply which is still "open" :). Even though I cant remember the exact details I think that what I wanted to achieve was a completely absolute-path-free development environment. Using your suggested technique would make my project dependent on my tomcat location (which would be fine for me but not for other developers of if I choose to move the project to another location).
Since you would do that change in tomcat, that wouldn't get committed to your SCM and thus other devs won't be affected ... but they'd have to do the change on their own. Otherwise, you can upgrade to full version of IntelliJ :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.