简体   繁体   中英

How does Tomcat know where my IntelliJ webapp war file is on a Mac?

My setup is IntelliJ 15 Ultimate installed on MacOS (Yosemite) with a Tomcat 8 configuration.

I've got my webapp working - no issues there - when I open up a browser at http://localhost:8080/ this all works fine. However when I go to /usr/local/Cellar/tomcat/8.0.27/libexec/webapps I don't see the .war file of the project I am using.

I'm expecting to see something like MavenTomcatServlet.war. Having read a few posts on here, I've found that IntelliJ deploys to /Users/c1900406/Documents/development/MavenTomcatServlet/target (this is defined as default in the Tomcat run configuration I have) - and things seem to work with this configuration. enter image description here

My question is, since this war is not in the webapps folder, how does Tomcat know about this file and read it?

Is this configuration good practice? Or should IntelliJ be configured to place war files in the webapp directory?

Although it is possible to change the Tomcat webapp directory or change the context path of an web application , I don't think IntelliJ IDEA is doing that.

Note that Tomcat has several different ways of deploying webapps and most probably IDEA is using one of them, most probably using JMX (the Tomcat plugin is not open source and I couldn't information of its internals).

The screenshot you provided shows where the artifact output folder is (where the war is put after being build). IDEA simply passes this path to the Tomcat deployer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM