springbootプロジェクトzipパッケージのパッケージングプラグインアセンブリ

Mavenは、パッケージングプラグインアセンブリを構成します。通常、このパッケージは、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>

上記のラベルは、変更する必要がある2つを説明しています。finalNameは、生成されたファイル名のAB.zipのAであり、記述子には、以下の特定の構成と構成ファイルのパスが含まれています

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>

上記ラベルは、変更する必要がある2つについて説明します。idは生成されたファイル名のAB.zipのBで、フォーマットは何か他のものに変更することができAB.zip、のジップ接尾辞です。ファイルセットは、ディレクトリのファイルをoutputDirectoryにコピーするためのものであり、ファイルは、ソースの特定のjarをoutputDirectoryに移動するためのものです。

ファイル名:最後に生成されたファイル名は、pom.xmlのfinalName、次に水平バー-、assembly.xmlのIDであり、ファイルのサフィックスとしてassembly.xmlの形式を使用します。これを例としてfastbootを使用します。 -app.zip

おすすめ

転載: blog.csdn.net/Mint6/article/details/102878085