首页 > 其他分享 >springboot 资源分离 打包

springboot 资源分离 打包

时间:2023-01-05 17:36:38浏览次数:51  
标签:springboot plugin -- 分离 maven resources copy 打包 build

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>

                    <!-- 排除文件配置 -->
                    <!-- <excludes> -->
                    <!-- <exclude>*.**</exclude> -->
                    <!-- <exclude>*/**.xml</exclude> -->
                    <!-- </excludes> -->

                    <!-- 包含文件配置,现在只打包 com 文件夹 -->
                    <includes>
                        <include>
                            **/cn/**
                        </include>
                    </includes>

                    <archive>
                        <manifest>
                            <!-- 配置加入依赖包 -->
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <useUniqueVersions>false</useUniqueVersions>
                            <!-- Spring Boot 启动类(自行修改) -->
                            <mainClass>cn.hb.jisheng.icons.IconsApplication</mainClass>
                        </manifest>
                        <manifestEntries>
                            <!-- 外部资源路径加入 manifest.mf 的 Class-Path -->
                            <Class-Path>resources/</Class-Path>
                        </manifestEntries>
                    </archive>
                    <!-- jar 输出目录 -->
                    <outputDirectory>${project.build.directory}/pack/</outputDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <!-- 复制依赖 -->
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <!-- 依赖包 输出目录 -->
                            <outputDirectory>${project.build.directory}/pack/lib</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <!-- 复制资源 -->
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                </resource>
                            </resources>
                            <!-- 资源文件 输出目录 -->
                            <outputDirectory>${project.build.directory}/pack/resources</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

 

标签:springboot,plugin,--,分离,maven,resources,copy,打包,build
From: https://www.cnblogs.com/jssoft/p/17028317.html

相关文章