maven-assembly-plugin 简单的使用
新建 maven 项目
这里新建一个 assembly-plugin-learn
项目
pom.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| <?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>
<groupId>org.titvax.study</groupId> <artifactId>assemblypluginlearn</artifactId> <version>1.0-SNAPSHOT</version>
<build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>3.1.1</version> <configuration> <finalName>assemblPluginStudy</finalName> <descriptors> <descriptor>package.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
|
package.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd"> <id>package.xml</id> <formats> <format>dir</format> <format>tar.gz</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <fileSets> <fileSet> <directory>target/</directory> <includes> <include>assemblypluginlearn-1.0-SNAPSHOT.jar</include> </includes> <outputDirectory>output</outputDirectory> </fileSet> </fileSets> </assembly>
|
打包
命令
打包后的结果如下所示