What is the purpose of mvnw and mvnw.cmd files?

前端 未结 4 1918
余生分开走
余生分开走 2020-12-12 08:50

When I created a Spring Boot application I could see mvnw and mvnw.cmd files in the root of the project. What is the purpose of these two files?

4条回答
  •  攒了一身酷
    2020-12-12 09:18

    Command mvnw uses Maven that is by default downloaded to ~/.m2/wrapper on the first use.

    URL with Maven is specified in each project at .mvn/wrapper/maven-wrapper.properties:

    distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
    

    To update or change Maven version invoke the following (remember about --non-recursive for multi-module projects):

    ./mvnw io.takari:maven:wrapper -Dmaven=3.3.9 
    

    or just modify .mvn/wrapper/maven-wrapper.properties manually.

    To generate wrapper from scratch using Maven (you need to have it already in PATH run:

    mvn io.takari:maven:wrapper -Dmaven=3.3.9 
    

提交回复
热议问题