At present, most of the construction methods of our projects are maven and gradle, but compared to gradle, the construction speed of maven is slower, especially when there are relatively many modules, the construction speed is more obvious. However, it will be relatively troublesome and costly for us to replace the project from maven to gradle. So we can choose mvnd to build the project, which can make the project faster and the project does not require any changes.
1. Download mvnd
github address:
https://github.com/apache/maven-mvnd
I am using a windows system, so I downloaded the maven-mvnd-1.0-m6-m39-windows-amd64.zip package
2. Install mvnd
Unzip the downloaded compressed package and add the bin directory to the environment variable path. For example, my directory is:
D:\mvnd\maven-mvnd-1.0-m6-m39-windows-amd64\bin
So just add this directory to the path and test whether the installation is successful.
mvnd -v
The message in the picture appears indicating that the installation is successful.
3. Use mvnd
The command we use to build the project using maven is:
mvn clean install
Similarly, the command we use to build the project using mvnd is:
mvnd clean install
4. Configuration modification
In order to be minimally compatible with the original Maven, you can use maven's original setting.xml file, open the /conf/mvnd.properties file in the Maven-mvnd installation directory, and modify it as follows:
maven.settings=D://maven//apache-maven-3.5.4//conf//settings.xml
5. Build speed test
First we use maven to build. The project has 27 sub-modules. The build time is as shown in the figure below:
We use mvnd to build. The project also has 27 sub-modules. The build time is as shown in the figure below:
It can be seen that the maven build takes 43.158 s and the mvnd build takes 9.186 s, which is nearly 5 times faster.
If you find any deficiencies while reading, please leave a message! ! !