springboot项目打zip包之打包插件assembly

maven配置打包插件assembly,一般打这个包是要配置自动化部署jenkins等工具需要。

pom.xml

<plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <finalName>fastboot</finalName>
                    <descriptors>
                        <descriptor>src/assembly/assembly.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id> <!-- this is used for inheritance merges -->
                        <phase>package</phase> <!-- bind to the packaging phase -->
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

上面标签解释一下你需要改的两个,finalName是生成文件名的 A-B.zip的A,descriptor里面是读取下面具体配置的,配置文件路径

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">
    <id>app</id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <fileSets>
        <fileSet>
            <directory>bin</directory>
            <outputDirectory>bin</outputDirectory>
        </fileSet>
    </fileSets>
    <files>
        <file>
            <source>target/fastboot.jar</source>
            <outputDirectory>/lib</outputDirectory>
        </file>
    </files>
</assembly>

上面标签解释一下你需要改的两个,id是生成文件名的 A-B.zip的B,format是A-B.zip的zip后缀,可以改成别的。 filesets是把directory的文件复制到outputDirectory下面,file是把source的具体jar移动到outputDirectory下面。

文件名:最后生成的文件名是,pom.xml的finalName,然后横杠-,assembly.xml的id,然后以assembly.xml里面的format作为文件后缀,以这里为例就是fastboot-app.zip

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值