The packaging plug-in assembly of springboot project zip package

Maven configures the packaging plug-in assembly. Generally, this package is required to configure automated deployment tools such as 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>

The above label explains the two you need to change, finalName is the A of AB.zip of the generated file name, and the descriptor contains the specific configuration below and the configuration file path .

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>

The above label explains the two you need to change, id is the B of AB.zip of the generated file name, format is the zip suffix of AB.zip, you can change it to something else. Filesets is to copy the files of the directory to the outputDirectory, and file is to move the specific jar of the source to the outputDirectory.

File name : The last generated file name is the finalName of pom.xml, then the horizontal bar -, the id of assembly.xml, and then use the format in assembly.xml as the file suffix. Take this as an example, fastboot-app.zip

Guess you like

Origin blog.csdn.net/Mint6/article/details/102878085