插件设置
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<!--指定打包描述文件的位置:相对项目根目录的路径-->
<!--assembly打包的描述文件-->
<descriptors>
<descriptor>
src\assembly\assembly.xml
</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
src\assembly\assembly.xml是自己新建的,可能位置不同
assembly.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<id></id>
<formats>
<format>tar.gz</format><!--打包的文件格式,也可以有:war zip-->
</formats>
<!--tar.gz压缩包下是否生成和项目名相同的根目录-->
<includeBaseDirectory>true</includeBaseDirectory>
<dependencySets>
<dependencySet>
<!--是否把本项目添加到依赖文件夹下-->
<useProjectArtifact>true</useProjectArtifact>
<outputDirectory>lib</outputDirectory>
<!--将scope为runtime的依赖包打包-->
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>src/main/bin</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>