Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

The structure of Maven Wrapper and the method of downloading and using it

Shulou Source: shulou.com Published: 2022-06-02 04:48:18 10月04日 Update

This article mainly explains the structure of Maven Wrapper and the method of downloading and using it. The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the structure of Maven Wrapper and the method of downloading and using it.

Brief introduction

It is necessary to use maven or gradle to develop java projects, and maven may be more common than gradle. To use maven, it is necessary to install maven. What if some users do not want to install maven? Or users do not want to install maven globally, so you can use project-level Maven Wrapper to achieve this functionality.

If you use IntelliJ IDEA to develop a Spring boot project, and if you choose to create a project from Spring Initializr, Maven Wrapper will be automatically applied in the project. To put it simply, there will be two more files under the project directory: mvnw and mvnw.cmd.

The structure of Maven Wrapper

Mvnw is the startup file of the Linux system.

Mvnw.cmd is the startup file of the windows system.

This article will not explain the internal information of the startup file in detail, interested partners can study it on their own. In addition to these two startup files, a hidden folder of .mvn is generated in the project. As shown in the following figure:

Image

Let's take another look. Mvn/wrapper/maven-wrapper.properties:

DistributionUrl= https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip

WrapperUrl= https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

This file specifies the versions of maven and maven wrapper.

Download Maven Wrapper

If we don't use IntelliJ IDEA, how can we download Maven Wrapper?

Under the home directory of the program:

Mvn-N io.takari:maven:wrapper

To specify a maven version:

Mvn-N io.takari:maven:wrapper-Dmaven=3.5.2

-N means-non-recursive, which will only be downloaded once in the home directory.

Use

The use of Maven Wrapper is the same as the maven command, such as:

. / mvnw clean install

. / mvnw spring-boot:run

Thank you for your reading, the above is the content of "the structure of Maven Wrapper and the method of downloading and using". After the study of this article, I believe you have a deeper understanding of the structure of Maven Wrapper and the method of download and use. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: File project structure method directory learning two content that is version user system development research necessary necessary information global interest function Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Linux Apple Microsoft Redmi