SpringBoot Zip打包

 

assembly.xml文件基本配置:

<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">

    <!-- 必须写,否则报Assembly ID must be present and non-empty错误,这个字符串会追加到zip包名字的末尾 -->
    <id>rhxy</id>

    <!-- 打包后的文件格式,可以是zip,tar,tar.gz,jar,dir,war -->
    <formats>
        <format>zip</format>
    </formats>

    <fileSets>
        <!-- 项目的配置文件,打包到zip文件的conf目录 -->
        <fileSet>
            <outputDirectory>conf</outputDirectory>
            <includes>
                <include>es/*</include>
                <include>sharding*.yml</include>
                <include>application*.properties</include>
            </includes>
            <directory>${project.basedir}/src/main/resources</directory>
        </fileSet>

        <!-- 项目的脚本文件,打包到zip文件的bin目录 -->
        <fileSet>
            <outputDirectory>bin</outputDirectory>
            <directory>${project.basedir}/src/main/bin</directory>
        </fileSet>

        <!-- 项目的日志文件,打包到zip文件的log目录 -->
        <fileSet>
            <directory>${project.basedir}/src/main/logs</directory>
            <outputDirectory>log</outputDirectory>
        </fileSet>

        <!-- 项目本身的jar文件,打包到zip文件的jar目录 -->
        <!--fileSet>
            <outputDirectory>jar</outputDirectory>
            &lt;!&ndash; 多个model打包,必须写,否则报A zip file cannot include itself错误 &ndash;&gt;
            <includes>
                <include>*.jar</include>
            </includes>
            <directory>${project.build.directory}</directory>
        </fileSet>-->
    </fileSets>

    <!-- 项目依赖的jar文件,打包到zip文件的lib目录 -->
    <dependencySets>
        <dependencySet>
            <outputDirectory>lib</outputDirectory>
            <unpack>false</unpack>
            <useProjectArtifact>false</useProjectArtifact>
        </dependencySet>
    </dependencySets>

</assembly>

 

1.https://blog.csdn.net/gaopeng0071/article/details/81566225

2.https://zhangjava.coding.me/springboot%E5%B0%86%E9%A1%B9%E7%9B%AE%E4%B8%8E%E4%BE%9D%E8%B5%96%E5%88%86%E5%BC%80%E6%89%93%E5%8C%85/

3.https://gitee.com/geekidea/spring-boot-assembly

4.https://cloud.tencent.com/developer/article/1354070

5.http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html

posted @ 2019-08-07 18:04  如幻行云  阅读(2276)  评论(0编辑  收藏  举报