Create Maven Subproject: Quick Guide
To create a subproject in Maven, you can follow these steps:
- Add the information of the sub-module in the parent project’s pom.xml file.
<modules>
<module>子模块名称</module>
</modules>
- Create a directory with the same name as the submodule in the root directory of the parent project, and create the submodule’s pom.xml file in that directory.
- Define the basic information and dependencies of the module in the pom.xml file of the submodule, and then add the submodule to the parent project.
- Navigate to the root directory of the parent project in the command line and run the following command to build the submodules:
mvn clean install
This successfully creates a Maven subproject.