SpringBoot项目引入本地jar,并打包(war、jar)

1.maven引入本地jar包

<dependency>
    <groupId>com.test</groupId>
    <artifactId>test</artifactId>
    <version>0.0.1</version>
    <type>jar</type>
    <scope>system</scope>
    <systemPath>${basedir}/lib/test.jar</systemPath>
</dependency>

2.打jar包插件

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

3.打war包插件

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
        <webResources>
            <resource>
                <directory>src/main/resources/lib</directory> <!-- 本地jar存放在项目中的位置 -->
                <targetPath>WEB-INF/lib</targetPath>
                <filtering>false</filtering>
            </resource>
        </webResources>
    </configuration>
</plugin>

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