003-Maven related operations in IDEA of Java Web Learning (2)

Disclaimer: All my articles are the compilation of online teaching videos, including Mad God Talk, Shang Silicon Valley, Dark Horse Programmer, etc., used as reference materials, without any commercial use, please refer to the majority of netizens, please do not spray ,Thank you.
6. Maven settings
003-Maven related operations in IDEA of Java Web Learning (2)
003-Maven related operations in IDEA of Java Web Learning (2)
in IDEA Note: A problem often occurs in IDEA, that is, after the project is automatically created, its Maven home directory will use IDEA's default. If we find this problem, manually change it to the local one.
Therefore, after our IDEA project is successfully created, we need to look at the Maven configuration.
6. At this point, the configuration and use of Maven in IDEA is OK!
7. Create an ordinary Maven project without using templates.
003-Maven related operations in IDEA of Java Web Learning (2)
Do not tick Create from archetype and click Next.
The operation is almost the same as before, except that the project name is changed to javaweb-01-maven02. We will find that we are not required to set up Maven at this time. After completion, it does not download the jar package. , This is the cleanest Maven project.
003-Maven related operations in IDEA of Java Web Learning (2)
Note: The directory in the generated project is different from the one generated by the previous template.
main->java: used to store the source code
main->resource: used to store some configuration files
test->java: used to test
the project generated by the previous template, the directory is organized as follows:
main->webapp: used to place one Web application
WEB-INF: Used to store the configuration file
of the web application Index.jsp: It is the home page of the web application
003-Maven related operations in IDEA of Java Web Learning (2)
8. We know the difference between the two, so we manually add the corresponding in the project created by the template Directory, to facilitate our development.
9. After establishing the corresponding directory, mark the directory, mark the java directory as the source code directory Sources Root, and mark the resources directory as the resource directory Resources Root. The test directory can now be created without creating it.
003-Maven related operations in IDEA of Java Web Learning (2)
10. You can also mark the directory through File->Project Structure->Project Settings->Modules.
003-Maven related operations in IDEA of Java Web Learning (2)
11. Configure tomcat in IDEA and click Add Configuration...
003-Maven related operations in IDEA of Java Web Learning (2)
In the pop-up window, click the + sign in the upper left corner and select from the drop-down list Local under Tomcat Server.
003-Maven related operations in IDEA of Java Web Learning (2)
003-Maven related operations in IDEA of Java Web Learning (2)
In the pop-up window, configure the tomcat server. Among them, to modify the Application server item to use our own tomcat, click Configure...
003-Maven related operations in IDEA of Java Web Learning (2)
If there is a server, you can click the "-" sign in the upper left corner Delete
003-Maven related operations in IDEA of Java Web Learning (2)
and then click on the "+" sign to re-create. In the pop-up window, select the directory where our tomcat is located. After the
003-Maven related operations in IDEA of Java Web Learning (2)
configuration is completed, we will find a warning message below our window, which means that the deployment is not marked For the project,
003-Maven related operations in IDEA of Java Web Learning (2)
we select the Deployment tab to deploy the project and
003-Maven related operations in IDEA of Java Web Learning (2)
click the "+" sign on the right to deploy the project
003-Maven related operations in IDEA of Java Web Learning (2)
003-Maven related operations in IDEA of Java Web Learning (2)
003-Maven related operations in IDEA of Java Web Learning (2)
. At this time, the warning below disappears.
Application context: part of the application context can be filled or not filled, if not filled, the default access path is localhost:8080; if you fill in /kuang, the access path is localhost:8080/kuang; this is the virtual path mapping. We fill in /kuang here.
003-Maven related operations in IDEA of Java Web Learning (2)
Click OK to complete the configuration. Back to the main interface of IDEA, start the Tomcat server
003-Maven related operations in IDEA of Java Web Learning (2)
if an error occurs, for example:
java.rmi.server.ExportException: Port already in use: 1099; nested exception is:
java.net.BindException: Address already in use: JVM_Bind
represents that a process in our machine occupies port 1099. At this time, we can solve this:

  • After running cmd, enter netstat -ano and a list will appear, and find the port in the error message (here is 1099)
  • After finding this line, write down the process number: here is 5576, then open the task manager, enter the detailed information page, find the process with pid 5576, select the end process in the lower right corner, end the process, and restart the Tomcat server.
    003-Maven related operations in IDEA of Java Web Learning (2)
    After successful startup, the following page will appear in our browser:
    003-Maven related operations in IDEA of Java Web Learning (2)

Guess you like

Origin blog.51cto.com/12859164/2543873