lvxianchao / notes

狗屁不通瞎写的博客
https://coderlxc.com
1 stars 0 forks source link

SpringBoot 多模块项目中引入本地 Jar 包 #61

Open lvxianchao opened 7 months ago

lvxianchao commented 7 months ago

一、在需要的模块里引入本地 jar

先将本地的 jar 包放到需要的子模块下的 src/main/resources/lib 目录下,lib 是我手动新建的,然后修改子模块的 pom.xml,添加依赖

<dependencies>
    <dependency>
        <groupId>com.hikvision</groupId>
        <artifactId>artemis-http-client</artifactId>
        <version>1.1.11</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/src/main/resources/lib/artemis-http-client-1.1.11.RELEASE.jar</systemPath>
    </dependency>
</dependencies>

二、配置项目根目录的 pom.xml

在项目要目录的 pom.xml 里添加上:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <includeSystemScope>true</includeSystemScope>
            </configuration>
        </plugin>
    </plugins>
</build>