Today we share some dry goods directly, aside from the principle...
Scenario: If you are doing R&D in a large team, you should not be unfamiliar. In many cases, a project consists of multiple projects. In the process of research and development, it is necessary to repeat the construction of the project, and there are various versions that rely on jar, and there is no unified standard! Some people say that I can create a project and provide it to others, but this method is not very flexible! Today we talk about a more flexible and general way - Maven template project.
The so-called Maven template project means that the skeleton of the project has been defined in this project, the basic jar package required for dependencies is specified, and some common components are even coded. Users can start coding directly through the template project. This project is uploaded to the company's private library through Maven, and everyone shares it together. The benefits of doing this are:
1) Unify the engineering specifications of the entire development team (such as module naming, dependency version numbers, public components, etc.)
2) Quickly build projects, which improves the speed of developing and building projects
3) Promotion is more convenient
In the following, we will discuss in two aspects
1. How to do this maven template project?
Step 1: Create a Maven module project and define it according to your own project specifications
Step 2: Enter the root path of the project
Step 3: Execute the command
mvn archetype:create-from-project
Step 4: After executing the command, the target directory will be generated in the root directory, and then enter the path
target/generated-sources/archetype
Step 5: Execute the command
mvn install deploy
After five steps, the maven template project is published to the private library.
2. How to use this template project to create your own project?
The first step: eclipse new template project New->Maven, select Maven Project as shown below
NEXT
NEXT
Next
Enter the coordinate information of the module project and the private library address, click OK
Select the template you just added and click Next
Enter your own package path and project name, and click Finish to create a specific development project. The specific project style is as follows: