First create a maven_ssm folder under eclipse to facilitate code management, and then create parent and child projects in this folder:
1. The creation of the parent project
*** Ctrl + N shortcut key to create parent project
The parent project of the maven project selects the Maven Project under Maven:
Check to create a simple parent project:
Fill in the relevant information of the parent project to be created:
*** The packaging method of the parent project is pom
2. Creation of sub-projects
The creation methods of the sub-projects all comply with the following principles, and only the sub-project ssm_utils is used for demonstration:
*** Ctrl + N shortcut key to create a subproject
The subproject of the maven project selects the Maven Module under Maven:
Check to create a simple subproject:
Fill in the relevant information of the subproject to be created:
*** The packaging method of the subproject is jar by default, but the final subproject ssm_web should be changed to the packaging method of war :
The final subproject ssm_web should be changed to the packaging method of war :
***After creating the subproject ssm_web, there is no WEB-INF folder under the webapp, you need to import it manually, select the subproject ssm_web, right-click and select Java EE Tools -> Generate Deployment Descriptor Stub, and the import will be successful!
3. Connection dependencies
We know that the dependencies between parent and child projects are:
ssm_web -> ssm_service -> ssm_dao -> ssm_domain -> ssm_utils -> ssm_parent
Among them, the sub-project ssm_utils automatically inherits the dependencies in the parent project ssm_parent. Let's simply make the sub-project ssm_domain depend on the sub-project ssm_utils. The method of operating dependencies between other sub-projects is the same as this:
Graphical interface to add dependencies:
After the graphical interface completes the dependency injection, you can view the original pom.xml file of the subproject ssm_domain to verify whether the dependency is completed: