IDEA
仍是其餘的SDS
開發工具亦或是https://start.spring.io/ 進行解壓,咱們都會獲得一樣的一個pom.xml
文件<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.6.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.github.dqqzj</groupId> <artifactId>springboot</artifactId> <version>0.0.1-SNAPSHOT</version> <name>springboot</name> <packaging>jar</packaging> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
parent
標籤的含義spring-boot-starter-parent
座標<?xml version="1.0" encoding="utf-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>2.1.6.RELEASE</version> <relativePath>../../spring-boot-dependencies</relativePath> </parent> <!-- 省略無關代碼...... --> <build> <!-- 省略無關代碼...... --> <pluginManagement> <plugins> <!-- 省略無關代碼...... --> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <id>repackage</id> <goals> <goal>repackage</goal> </goals> </execution> </executions> <configuration> <mainClass>${start-class}</mainClass> </configuration> </plugin> <!-- 省略無關代碼...... --> </plugins> </pluginManagement> </build> </project>
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>2.1.6.RELEASE</version> <relativePath>../../spring-boot-dependencies</relativePath> </parent>
說明咱們的工程能夠進行改造進行替換掉原來工程的parent
標籤.html
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <id>repackage</id> <goals> <goal>repackage</goal> </goals> </execution> </executions> <configuration> <mainClass>${start-class}</mainClass> </configuration> </plugin>
repackage
必需要有不然打jar
包時候沒法正常啓動.java
在配置文件加上repackage
便可linux
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
IDEA
自帶maven
工具git
mvnw
是基於linux
的shell
腳本命令github
mvnw.cmd
是基於windows
的腳本命令spring
.mvn
包含了 maven
下載路徑以及版本等信息shell
也就是說咱們徹底不用本身下載maven
而是能夠直接使用IDEA
給咱們提供的工具便可,只不過一般不會這麼作。apache
repackage
的做用正常狀況下打包會生成springboot-0.0.1-SNAPSHOT.jar.original
,springboot-0.0.1-SNAPSHOT.jar
這樣的2個文件,而repackage
的做用就是將springboot-0.0.1-SNAPSHOT.jar.original
從新打包爲咱們能夠執行的springboot-0.0.1-SNAPSHOT.jar
windows