美文网首页程序员
springBoot项目使用mave引入本地jar包

springBoot项目使用mave引入本地jar包

作者: goldenJetty | 来源:发表于2019-03-05 20:37 被阅读0次

背景

很多时候,我们在和第三方进行对接的时候,如果第三方只给我们一个 jar 包,那么这时候需要我们进行手动导入项目中。

环境为:springBoot + maven + java web

实现

1、项目resource目录下添加 jar 包

我们一般统一放在 resources/lib 文件夹下


2、在 maven 中引入

修改项目的 pom.xml 文件,增加配置:

<dependency>
    <groupId>cn.xfyun</groupId>
        <artifactId>raasr</artifactId>
        <version>2.0.0.1006</version>
        <scope>system</scope>
    <systemPath>${project.basedir}/src/main/resources/lib/lfasr-sdk-client-2.0.0.1006.jar</systemPath>
</dependency>

3、项目打包的时候将该 jar 包打进去

增加一行配置:<includeSystemScope>true</includeSystemScope>
详细如下:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <mainClass>com.Jet.jetApplication</mainClass>
                <executable>true</executable>
                <includeSystemScope>true</includeSystemScope>
            </configuration>
        </plugin>
    </plugins>
</build>

更多技术博文请关注我博客站:http://www.jetchen.cn

相关文章

网友评论

    本文标题:springBoot项目使用mave引入本地jar包

    本文链接:https://www.haomeiwen.com/subject/gocauqtx.html