首页 /  技术专区  /  SpringBoot 宽屏模式 >

Springboot引入外部jar包

第一步:引入外部jar包。

在项目根目录下,新建目录libs,并把jar文件拷贝进来。(libs目录与src,pom.xml同级) 

image.png

第二步: 在pom.xml添加依赖

<dependency>
    <groupId>com.common</groupId>
    <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
    <version>1.0.0</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/libs/EPC_common.jar</systemPath>
</dependency>

其中除了scope、systemPath配置告诉maven引入的本地jar包的位置之外,其他的配置都可以随便写。


第三步:打包配置,还是修改pom.xml找到spring-boot-maven-plugin,添加includeSystemScope配置。

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




头像
0/200
图片验证码