Alxa
Alxa

Reputation: 79

What is the proper java app directory structure with Tomcat?

I started to learn JSP and Tomcat Container, and I know how the directories must be stored, but I'm confused by several things:

  1. If we use only web app, why do we need the rest of the folders here? (highlighted blue). Can I just delete them and load my project with "web" as root? enter image description here
  1. How can I initialize Gradle/Maven or use any other framework inside Tomcat web application? (e.g Where to put pom.xml file?)

Upvotes: 1

Views: 785

Answers (1)

Dropout
Dropout

Reputation: 13866

  1. The folder .idea and the file Tomcat-web-app.iml are necessary for your IDE, configuration is stored there. If you delete them the project will fall apart in your IDE. You can delete the src folder as long as you're not using it.

  2. pom.xml should be put on the root level of your project, so right under Tomcat-web-app/. Afterwards you can initialize it as a Maven project by adding framework support for Maven - right click on your project (Tomcat-web-app) and you should see it there. Refer to this guide if you're having issues. It is much more straight forward however to just create a Maven project from scratch and then copy in your web files.

Upvotes: 2

Related Questions