1. 程式人生 > >springboot2學習筆記:mvnw相關檔案生成

springboot2學習筆記:mvnw相關檔案生成

在學習springboot2的時候,我們會發現,可以用 命令 mvnw spring-boot:run 來啟動專案。

使用這個命令,依賴於專案中的 mvnw,mvnw.bat,mvnw資料夾

那麼怎麼生成這些檔案?

在pom.xml的檔案中,在<build></build>內部的<plugins></plubins> 加入一個plugin .

下面這個程式碼,從maven-wrapper的github裡抄過來的

<plugin>
        <groupId>io.takari.maven.plugins</groupId>
        <artifactId>provisio-maven-plugin</artifactId>
        <!--  careful - upgrade to 0.1.50 causes problem with extraction of tar.gz
        instead of into .mvn/wrapper it looses the .mvn path and extracts to wrapper -->
        <version>0.1.46</version>
        <extensions>true</extensions>
      </plugin>

加入後,再maven reimport一下

然後在終端執行命令:

mvn wrapper:wrapper

然後就生成了相關檔案

參考文章