打包组件assembly之package.xml

时间:2021-11-18 11:06:25

形如:

<assembly>
<id>deploy</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
<outputDirectory>lib</outputDirectory>
<includes>
<include>*:jar:*</include>
</includes>
<excludes>
<exclude>*:sources</exclude>
</excludes>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.basedir}/wrapper/bin</directory>
<outputDirectory>/bin</outputDirectory>
<fileMode>755</fileMode>
<includes>
<include>wrapper</include>
<include>service.sh</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/wrapper/lib</directory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>wrapper.jar</include>
<include>libwrapper.so</include>
</includes>
</fileSet>
</fileSets>
</assembly>

简单标签释义:

<id>deploy</id>

该标签内容首先不能为空,名称可任意定义,原则上就使用“deploy”,在 maven 编译打包后,其编译的包名会有“-deploy”的命名追加。

<formats>
<format>zip</format>
</formats>

该标签内容指定模块编译后的文件格式。原则上要求使用“zip”,在 maven 编译打包后,其编译的包会压缩成.zip 文件。

<includeBaseDirectory>false</includeBaseDirectory>

该处理是根据运维自动化部署的实际需要,必须设定该标签为“false”,在 maven 编译打包后,将不包含根级目录