[How To] Specify Tomcat Cache Directory For Webapp
Ok, here is the situation. I have a parent pom that contains two modules ... one is a REST service module (war) and the other is the website (also war). I am trying to run both webapps in IntelliJ at the same time. I have a run configuration for the service webapp that points to it's own CATALINA_BASE. And I have another run configuration for the website webapp that has it's own CATALINA_BASE. The separate bases contain app specific versions of server.xml and context.xml for each app. The first app (service module) starts up fine. However, when I try to start up the website, it tries to use the same IntelliJ cache directory as the service war and they step all over each other.
Here is the path that it tries to use:
/Users/<me>/Library/Caches/IntelliJIdea14/tomcat/Unnamed_myapp-parent-pom/conf/server.xml
And what I'd like it to use is:
Service:
/Users/<me>/Library/Caches/IntelliJIdea14/tomcat/myapp-service-pom/conf/server.xml
Website:
/Users/<me>/Library/Caches/IntelliJIdea14/tomcat/myapp-website-pom/conf/server.xml
Again, I can see that it is caching the version of server.xml from my CATALINA_BASE folder. It's just that both submodules use the same cache directory when running in IntelliJ because they both have the same parent pom.
Ideas? (Note: I realize I could change the pom structure, but I'm trying not to go there ... my colleague is able to do this in Eclipse and I want to be able to say that we can do it in IntelliJ too.)
请先登录再写评论。
The naming convention for that directory (called the Base Directory Name) is actual ${run_configuration_name}_${project_name}. (It just happens that your project name is named the same as your parent pom). The value used is created when you first create the run/debug configuration. However, it is not updated if/when you rename a run/debug configuration. This, IMHO, is a bug. I have reported it via IDEA-133536. Please vote for it.
So in your case, it looks like the first time you created each of those run/debug configuration, you did not change the name of the run/debug from its default of "unnamed" and that name was used when the Base Directory Name was created. As a result, you have to configurations that are using the same Base Directory Name. You have two options as a workaround:
Yep, that was it. I've voted for the defect ... lost a lot of time today on this. But thanks for your help.