I have never tried using maven to manage projects before, but it is indeed inconvenient to manually find packages and guide packages, so today I used the 2016 version of IDEA to make my first attempt at maven.
Open IDEA and create a new project:
Then select Maven and select your own computer's jdk:
Next, customize GroupId and ArtifactId, here is just a demo, so it is named casually
Then customize the project name, Finish:
Maven has been created
In maven, the first creation will generate the main/java and main/resources directories under src. The test directory in src is created by itself. The code in the test directory will not be published and used for testing.
Next, create a web project in maven:
Right-click Add Framework Support, and the project creation option appears:
Select the web project and click OK
Then configure the web project dependency package under pom.xml:
The prompt appears in the idea Maven projects need to be imported, click Import ChangesEnable Auto-Import to let maven automatically download the guide package
Check the External Libraries under the project and you will find that the dependency package has been downloaded:
Next, create a new servlet in the src/main/java directory
Finally configure the tomcat server:
Finally, publish and run, and then enter the servlet request in the browser:
Click to confirm
The servlet successfully handles the request response, and at this point, the maven successfully created the project
Summarize
The above is the new version of IntelliJ IDEA introduced to you by the editor to build maven and use Maven to create a web project. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support to Wulin.com website!