Use Idea to import eclipse javaweb project (super detailed)

B station video steps

click here

1. First choose to open the project

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-7HMZQLkR-1648609655260)(image-20220330102852907.png)]

2. After opening, it will look like this, only displaying the eclipse files of .classpath and .project
insert image description here

3. Open the project structure
insert image description here

4. Click modules in the project structre, then click the + sign, select import module, and select the location of the folder

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-1Fm5fXqf-1648609655272)(image-20220330103139585.png)]

insert image description here

5. Select eclipse and click next

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-pBGSAQDv-1648609655276)(image-20220330103348223.png)]

6. Select keep project and module files in, and then continue to click next

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-VL1lpmqp-1648609655278)(image-20220330103425986.png)]

7. Select the project name and click next
insert image description here

8. Click finish, then click yes
insert image description here

insert image description here

9. Delete the red report option (select it, then click the - sign)
insert image description here

10. Add lib, click the libraries in the project structre, click + to select Java, and then select the lib folder in the project, which is usually in the WEB-INF folder in web or webcontent.
insert image description here

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-yMGh2hbi-1648609655292)(image-20220330103956762.png)]

11. Add the newly added lib in Dependecies in Modules, and then add the tomcat server. After going out, remember to select lib and Tomcat as shown in the third picture below

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-BOiu5yAB-1648609655295)(image-20220330104119481.png)]

insert image description here

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-AwweCZvY-1648609655297)(image-20220330104222718.png)]

12. Add Web in Facets

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-XFJpFXGg-1648609655300)(image-20220330104320141.png)]

13. Delete all the two you already have, such as deleting the ones that have been circled in the figure below

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-uC5sA44C-1648609655302)(image-20220330104454562.png)]

14. Add the web.xml file in the project and the folder where the Web is stored. Generally, web.xml is in the project name\WebContent\WEB-INF\web.xml, and the folder where the web is stored is generally in the webcontent or web folder

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-upw18C0x-1648609655304)(image-20220330104945370.png)]

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-gaXX7uOO-1648609655306)(image-20220330105013007.png)]

15. Click artifacts, click the + sign, then select web application exploded, then select from modules, and select the project just now

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-yjrdXVo7-1648609655307)(image-20220330105104561.png)]

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-77VzHgkN-1648609655310)(image-20220330105249115.png)]

16. Click apply first, then click ok

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-4C4Q3aEi-1648609655311)(image-20220330105306035.png)]
17. To build a table in the database, first find the applicationContext.xml file or druid.properties configuration in the project, build a table according to the table name and modify the database login verification information

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-DJDpCXPm-1648621501140)(image-20220330141928310.png)]

18. Open navicat, create the relevant library name, place the mouse on the corresponding library name, right-click to run the SQL file, then find the .sql file, import the database, and refresh to view the import results

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-suS7qWo8-1648621501143)(image-20220330142250091.png)]

insert image description here

19. Finally, deploy the project on tomcat

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-x1QD0PHc-1648609655313)(image-20220330105535400.png)]

Click deployment to add artifact, select the project just now

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-tr6a6bMU-1648609655316)(image-20220330105555037.png)]

20. Change the application context to /project name

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-BxjXY8Dh-1648609655317)(image-20220330105649021.png)]

21. Then click server, and other configurations can be set according to the following figure

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-wCBHFvQv-1648609655321)(image-20220330105801151.png)]

22. Finally, start the project, click the small green icon in the upper right corner

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-VK1tEV6z-1648609655323)(image-20220330105949159.png)]

23. In this way, the service starts

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-FWWAWm0q-1648609655324)(image-20220330110017481.png)]

other considerations

If port 1099 is occupied when starting the Tomcat server (below)

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-mrgwVVcY-1648609655326)(image-20220330110345262.png)]

Solution steps:

1. Win+r opens the input cmd to open the black window

2. Enter netstat -aon|findstr 1099 to find the process that occupies the port

insert image description here

3.taskkill -f -pid 16988 (process number)

This will start Tomcat normally.

Guess you like

Origin blog.csdn.net/qq_42076902/article/details/123841422