Spring Boot 打包本地 jar 包到 war 包中

Spring Boot Maven Java About 1,170 words

本地依赖

本地jar包放置与resource文件夹下的lib文件夹。

<dependency>
    <groupId>com.example.utils</groupId>
    <artifactId>example-utils</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/src/main/resources/lib/example-utils-1.0.0-2020408_RELEASE.jar</systemPath>
</dependency>

war包插件

添加webResources节点。directory标签内配置本地jar位置,targetPath标签内配置最后打包到war包后jar包存放的位置。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
    <configuration>
        <warName>test-war</warName>
        <webResources>
            <resource>
                <directory>${project.basedir}/src/main/resources/lib/</directory>
                <targetPath>WEB-INF/lib</targetPath>
                <includes>
                    <include>**/*.jar</include>
                </includes>
            </resource>
        </webResources>
    </configuration>
</plugin>
Views: 2,098 · Posted: 2020-04-08

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh