请问基于maven的sprng boot的项目中如果想要导入本地的一些jar文件在打成jar包的时候如何让它们都被包含进去呢

1.最近项目需要对接第三方的提供的数据,需要我这边导入一些他们的jar包到项目里,当时搭建项目用的springboot,对于maven本地依赖jar,网上也搜了点资料,能在本地调试和编译的时候正常依赖,但是在打成jar包的时候,那些本地依赖的jar没有被导入到里面去,有没有了解基于springboot生成的fat jar中如何引入本地的jar包呢,项目是maven构建的,代码明天提供。
pom.xml:

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                    <compilerArguments>
                        <extdirs>${project.basedir}/lib</extdirs>
                    </compilerArguments>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <targetPath>BOOT-INF/lib/</targetPath>
                <includes>
                    <include>**/*.jar</include>
                </includes>
            </resource>

            <resource>
                <directory>src/main/resources</directory>
                <targetPath>BOOT-INF/</targetPath>
                <includes>
                    <include>**/*.properties</include>
                </includes>
            </resource>
        </resources>
    </build>

添加resouces配置后发现,打包后的jar里面虽然包含了自己本地jar,但是对于手动添加进去的applciation.properties却是不生效了,暂未找到问题原因

阅读 19.9k
评论
    7 个回答

    已解决,把父配置文件里面的resources依赖粘过来就行了,但是不太了解其中几个字段的意思像<filtering>、
    <excludes>

    <resources>
                <resource>
                    <directory>${basedir}/src/main/resources</directory>
                    <filtering>true</filtering>
                    <includes>
                        <include>**/application*.yml</include>
                        <include>**/application*.properties</include>
                    </includes>
                </resource>
                <resource>
                    <directory>${basedir}/src/main/resources</directory>
                    <excludes>
                        <exclude>**/application*.yml</exclude>
                        <exclude>**/application*.properties</exclude>
                    </excludes>
                </resource>
                <resource>
                    <directory>src/main/resources</directory>
                    <targetPath>BOOT-INF/lib/</targetPath>
                    <includes>
                        <include>**/*.jar</include>
                    </includes>
                </resource>
            </resources>