• jar包配置文件到单独文件夹


        <build>
    <!--        <finalName>sampling</finalName>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <includes>
                        <include>**/*</include>
                    </includes>
                </resource>
            </resources>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>2.5.2</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>-->
            <finalName>sampling-scxj</finalName>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <layout>ZIP</layout>
                        <includes>
                            <!-- jar中不包含其他依赖包-->
                            <include>
                                <groupId>nothing</groupId>
                                <artifactId>nothing</artifactId>
                            </include>
                        </includes>
                    </configuration>
                </plugin>
                <!--拷贝依赖到jar外面的lib目录-->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>copy-dependency</id>
                            <phase>package</phase>
                            <goals>
                                <goal>copy-dependencies</goal>
                            </goals>
                            <configuration>
                                <!--输出目录-->
                                <outputDirectory>${project.build.directory}/libs</outputDirectory>
                                <excludeTransitive>false</excludeTransitive>
                                <stripVersion>false</stripVersion>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <!-- 拷贝资源文件 到指定的resource目录-->
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>copy-dependencies</id>
                            <phase>package</phase>
                            <goals>
                                <goal>copy-resources</goal>
                            </goals>
                            <configuration>
                                <!-- 资源文件输出目录 -->
                                <outputDirectory>${project.build.directory}/config</outputDirectory>
                                <resources>
                                    <resource>
                                        <directory>src/main/resources</directory>
                                        <filtering>true</filtering>
                                        <!--包含的文件-->
                                        <includes>
                                            <include>*/**</include>
                                        </includes>
                                    </resource>
                                </resources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <!--指定配置文件-->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <configuration>
                        <archive>
                            <!-- 生成的jar中,不要包含pom.xml和pom.properties这两个文件 -->
                            <addMavenDescriptor>false</addMavenDescriptor>
                            <manifest>
                                <!-- 是否要把第三方jar加入到类构建路径 -->
                                <addClasspath>true</addClasspath>
                                <!-- 外部依赖jar包的最终位置 -->
                                <classpathPrefix>/libs/</classpathPrefix>
                                <!-- 配置项目启动类 -->
                                <mainClass>com.sean.soft.sampling.SamplingApplication</mainClass>
                            </manifest>
                            <!-- 指定配置文件的新目录-->
                            <manifestEntries>
                                <Class-Path>/config/</Class-Path>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>
            </plugins>
        </build>
  • 相关阅读:
    【python爬虫实战】使用词云分析来分析豆瓣影评数据
    【python爬虫实战】爬取豆瓣影评数据
    【个人博客设计】开发工具篇
    使用xmake优雅地描述工程
    使用lua实现try-catch异常捕获
    tbox新增stackless协程支持
    如何快速构建一个简单的程序
    手写数字识别系统之倾斜矫正
    手写数字识别系统之图像分割
    聊聊原子操作那些事
  • 原文地址:https://www.cnblogs.com/seanRay/p/15686989.html
Copyright © 2020-2023  润新知