1 Introduction
maven-mvnd
It is a sub-project of maven, not a brand new build tool, but an extension tool based on maven. The Apache Maven team got inspiration from Gradle and Takari (Maven life cycle optimizer) to enhance Maven, and derived the maven-mvnd project to improve the build performance of maven.
Github address: https://github.com/apache/maven-mvnd
2. Install
- Download medium https://github.com/mvndaemon/mvnd/releases
- Unzip and install
- Modify the configuration file
Find the mvnd.properties configuration file under the conf folder of the root directory after decompression, and configure the maven.settings property value as the file path of the maven configuration file settings.xml. Note: The storage location of this settings.xml file is not limited. - Configure environment variables
Add the bin directory of mvnd to the environment variables of the system.
3. Test
Take a more complex local project as an example.
- Package by mvn command
# 执行打包命令
mvn clean package -Dmaven.test.skip=true
# 执行结果
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 44.919 s
[INFO] Finished at: 2021-12-27T14:49:03+08:00
[INFO] ------------------------------------------------------------------------
- Package by mvnd command
# 执行打包命令
mvnd clean package -Dmaven.test.skip=true
# 执行结果
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.221 s (Wall Clock)
[INFO] Finished at: 2021-12-27T14:50:59+08:00
[INFO] ------------------------------------------------------------------------
It can be seen that the performance of using commands mvnd
to build is indeed better mvn
, and the build effect of complex projects may be better.