MAVEN projects in work often have parent-child structures, and there are interdependent relationships in the substructure project. 1, the project needs
To create a MAVEN parent-child project in Eclipse today, for example, you need to build a MAVEN project with the following relationships.
2, build a parent Maven project create a new MAVEN project, as shown in the following illustration: Select the default workspace, work set, and click "Next" to select the "Maven-archetype-quickstart" type , click "Next" to fill in the group ID, artifact ID, Version, click "Finish" the project is completed, the project structure will be deleted except Pom.xml files, then click the Maven "Update Project" button
after refreshing, the parent project is structured as follows
This project will be used to establish its subproject
3, build a child Maven project using Eclipse to build a maven subproject is simple, Open the Pom.xml file for the parent project, modify the packaging type to Pom, and after saving, the Modules option can be expanded. (If the Pom file is an error, refresh it with maven)
Click the "Create" button in the Modules option to create a child Maven project
Fill in module Name and then click Next
to select the corresponding type, which is generally more than two types. Maven-archetype-quickstart is a normal Java project, Maven-archetype-webapp for Java Web Project
Click Finish, Eclipse automatically creates a subproject named Wood-service Project and is a wood-project, at which point you can see the subproject's folder in your parent project, indicating that the creation was successful, and the Pom file for the parent-child project was automatically configured and no more configuration required
You can then use this method to establish multiple subprojects, as shown in the following illustration:
4, building dependencies building dependencies is simpler, if wood-web projects need to rely on wood-service projects, Then open the Pom file in the Wood-web project and add the following code:
At this point, Eclipse created the MAVEN parent-child project is complete.