SpringBoot引入本地jar包

resources目录下新建lib文件夹,然后将需要的本地jar包放入进去

pom文件中引入本地jar包依赖

${project.basedir}就是moudle 所在目录


    com.XXX
    XXXXX
    0.0.1-SNAPSHOT
    system
    ${project.basedir}/src/main/resources/lib/XXXXX.jar

JAR包

在springboot的maven工具增加includeSystemScope功能

作用:打包时将scope为system的jar包一并打入包内

<plugin>
    <groupId>org.springframework.bootgroupId>
    <artifactId>spring-boot-maven-pluginartifactId>
    <configuration>
        
        <includeSystemScope>trueincludeSystemScope>
        <fork>truefork>
    configuration>
plugin>

WAR包

多模块项目几个模块需要配置几个resource

<plugin>
    <groupId>org.apache.maven.pluginsgroupId>
    <artifactId>maven-war-pluginartifactId>
    <version>3.2.2version>
    <configuration>
        <failOnMissingWebXml>falsefailOnMissingWebXml>
        <warName>${project.artifactId}warName>
        <webResources>
            <resource>
                 <directory>${basedir}/../payment-api/src/main/resources/lib/directory>
                <targetPath>WEB-INF/lib/targetPath>
                <includes>
                    <include>**/*.jarinclude>
                includes>
            resource>
            <resource>
                <directory>${basedir}/../payment-common/src/main/resources/libdirectory>
                <targetPath>WEB-INF/lib/targetPath>
                <includes>
                    <include>**/*.jarinclude>
                includes>
            resource>
        webResources>
    configuration>
plugin>

你可能感兴趣的:(maven,SpringBoot,maven,jar,spring,boot)