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

背景

很多时候,我们在和第三方进行对接的时候,如果第三方只给我们一个 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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。