Article Directory
foreword
Either way, they all have the same premise, that is, first place the web project you want to import in the project directory you want to import
For example (example): The author wants to import a web project named mavenWeb1 (the author's own) into the P5 project (the author's own), then first of all, the mavenWeb1 file needs to be placed under the P5 file, as shown in the following figure:
If your project is a brand new project, then you need to configure the Maven path first, because if you do not configure the global Maven path for IDEA, then every time you create a new project, the Maven path of the new project will be is the default path, as shown in the figure below: (How to find Maven: Click File in the upper left corner of IDEA---->click Settings...)
Enter maven in the search box and press Enter to reach the maven interface, and we see that the configuration of maven is the default
At this time, we need to change the default maven configuration to our own maven configuration (note: this is the author's maven configuration, the reader's maven configuration should be modified according to your own configuration)
1. The first method
First, follow the unified operation in the preface, and place the project you want to import under the project folder you want to import
Then click File in IDEA---->click Project Structure...
Click Modules---->Click the + sign---->Click Import Module
Find the Web project you want to import ----> click OK
Click Import module from external model---->click Maven---->click Finish
click OK
In this way, the first way to import the Web project is successful! ! !
2. The second way
First, follow the unified operation in the preface, and place the project you want to import under the project folder you want to import
Then click Maven on the right side in IDEA---->click the + sign
Find the web project you want to import -----> select the pom.xml file of this web project -----> click OK
In this way, the second way to import the Web project is successful! ! !
3. The third way
First, follow the unified operation in the preface, and place the project you want to import under the project folder you want to import
Then click File in the upper left corner in IDEA---->click Open...
Find the Web project you want to import -----> select this Web -----> click OK
Click Trust Project
Click on This Window or New Window
Be careful when using this method: The project imported in this way is equivalent to a new project, we also need to set maven configuration and jdk configuration by ourselves
Click File----->Click Settings... in the upper right corner of IDEA
Enter maven in the search box and press Enter. On the page we jump to, we find that the maven configuration has changed to the default configuration, so we also need to set the maven configuration for our own configuration.
After the maven modification is completed, you need to check the jdk configuration to see if the jdk version meets the jdk version required for the imported project.
Then click File----->Click Project Structure in the upper left corner of IDEA again...
Click Project-----> to check whether the jdk version meets the jdk version required for importing the project.
Then click Modules----->Click Sources to check whether the jdk version at label 3 is consistent. 7 corresponds to jdk7, and 8 corresponds to jdk8. If it matches, do not modify it, and if it does not match, modify it
Then click Dependencies to check whether the version number of the Module SDK matches the version of the imported project. 11 corresponds to JDK11. If it matches, do not modify it; if it does not, modify it
Then click SDKs to check whether the selected JDK version matches the imported project.
After all the above modifications are checked, the third way to import the Web project is OK! ! !