<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>3.0.0</version> <configuration> <!-- not append assembly id in release file name --> <appendAssemblyId>false</appendAssemblyId> <descriptors> <descriptor>src/main/assembly/release.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin>
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin>
在依賴配置中的descriptor標籤中定義了一個release.xml文件路徑,assembly則經過該配置文件,肯定打包的文件類型及其所包含的文件spring
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> <id>dist</id> <formats> <format>tar.gz</format> </formats> <includeBaseDirectory>true</includeBaseDirectory> <fileSets> <fileSet> <directory>src/main/bin</directory> <outputDirectory>bin</outputDirectory> <directoryMode>0777</directoryMode> <includes> <include>**/*</include> </includes> <fileMode>0777</fileMode> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>target/classes</directory> <outputDirectory>conf</outputDirectory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <excludes> <exclude>**/*.class</exclude> </excludes> </fileSet> <fileSet> <directory>target</directory> <outputDirectory>logs</outputDirectory> <excludes> <exclude>**/*</exclude> </excludes> </fileSet> </fileSets> <dependencySets> <dependencySet> <outputDirectory>lib</outputDirectory> <unpack>false</unpack> </dependencySet> </dependencySets> </assembly>
腳本文件的做用是爲了在Linux環境下可直接運行進行服務的安裝,因此須要事先將腳本編輯完成apache
執行mvn clean package -Dmaven.test.skip=true命令,在target目錄生成文件,解壓後,裏面包含bin、conf、lib、logs這四個目錄,在release.xml中能夠找到對應的配置,以及存放的數據與項目文件的對應關係,都在release.xml中進行設置app
百度雲:https://pan.baidu.com/s/1zi1zuKTeZHs8BBjYUxm1fg 密碼:rkpcmaven