Three ways for IDEA to import Web projects

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:
insert image description here


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...)
insert image description here


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
insert image description here


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)

insert image description here


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...

insert image description here


Click Modules---->Click the + sign---->Click Import Module

insert image description here


Find the Web project you want to import ----> click OK

insert image description here


Click Import module from external model---->click Maven---->click Finish
insert image description here


click OK
insert image description here


In this way, the first way to import the Web project is successful! ! !

insert image description here


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

insert image description here


Find the web project you want to import -----> select the pom.xml file of this web project -----> click OK

insert image description here


In this way, the second way to import the Web project is successful! ! !

insert image description here


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...

insert image description here


Find the Web project you want to import -----> select this Web -----> click OK

insert image description here


Click Trust Project

insert image description here


Click on This Window or New Window

insert image description here


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

insert image description here


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.

insert image description here


insert image description here


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.
insert image description here


Then click File----->Click Project Structure in the upper left corner of IDEA again...

insert image description here


Click Project-----> to check whether the jdk version meets the jdk version required for importing the project.
insert image description here


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
insert image description here


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

insert image description here


Then click SDKs to check whether the selected JDK version matches the imported project.

insert image description here


After all the above modifications are checked, the third way to import the Web project is OK! ! !

Guess you like

Origin blog.csdn.net/qq_45344586/article/details/131381728