Talking about _IDEA importing Eclipse Web project

I believe that many students will encounter the situation of importing an Eclipse Web project into IDEA in their work. Here I will talk about the specific operation process.

One: Import Project, select the project to be imported

Two: Choose to import as an Eclipse model

All the way west, oh no, all the way down~:


Select the version of JDK, I have already configured it here, if not, you can click + on the left to configure


As you can see, the project has been imported into IDEA. The .idea and .iml here are IDEA's project dependency files, don't care


Three: Carry out the necessary configuration operations for the project

Right-click the project name, press F4, or click the shortcut key to set the project structure


The above is the version of JDK, and the following is the output path after the project is compiled.


Select the Module on the left. This Module is the concept of IDEA, which is actually consistent with the idea of ​​Maven, that is, the idea of ​​multiple modules. A project consists of multiple Modules. Of course, this is an ordinary Web project, which is a Project is a Module.

Click the first tab on the right: Source, click the src directory, click Mark as Source, set the src directory as the source directory of the project, click APPLY


Click the second tab on the right: Path, the output path edited by the Compiler output project, keep the default configuration


Click the third tab on the right: Dependencies, the red font indicates dependencies that do not exist in IDEA, delete them manually, and click Apply


Select Libraries on the left, configure the jar package, click the + sign on the right, and select java


Select the lib folder of the imported project and click ok


Click Apply


Click Facets on the left, click the + sign, and select web. This concept also exists in eclipse, which is to indicate which components the project is composed of, such as web, spring, strtus, hibernate, etc.



In the configuration item on the right, the web.xml path is above, and the web root directory is below. They are all default paths, which do not match ours and need to be modified manually. Because the default web root directory name of idea is web, not eclipse's WebContent, like MyEclipse is WebRoot.


After the modification, there is a button of Create Artifact in the lower right corner . This Artifact refers to the directory that will be put into tomcat to run. But it will not really be copied to the tomcat installation directory. Just let tomcat find this path and run the program under the directory.



After clicking Create Artifact, in the configuration item on the right, the name can be modified or not modified. Type : Web Application: Exploded is a common type of web development and does not need to be modified. Output directory, the output path is the directory of this Artifact, idea will copy all the required resources, including class, lib, web directory, etc., to here in a directory structure that tomcat can recognize. And tomcat will directly use this directory to run the system. The default is the out directory that is the same level as src. Generally do not need to modify.


When the wavy line reports an error, it shows that you need to add the lib directory in Available Elements to the output root output directory on the left,

Right-click lib, select Put into/WEB-INF/lib;      right-click junit4, select Put into/WEB-INF/lib


Click Apply


Click OK


At this point, the configuration of the project is complete, configure Tomcat below

Four: Configure Tomcat


The name can be modified at will, and the browser can specify

Click on Deployment


Click the + sign and select Artifact


Application Context fill in the project name, click Apply, click OK, so far Tomcat configuration is complete


Now start Tomcat and run it~~~~


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324844641&siteId=291194637