springboot导入本地jar包

springboot导入本地jar包

首先在src下建目录lib,并将需要的本地jar包放入

在pom.xml下修改如下

 <!-- 导入云顿数据风控的jar -->
        <dependency>
            <groupId>aliyun</groupId>
            <artifactId>aliyun-java-sdk-afs</artifactId>
            <version>1.0.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/lib/aliyun-java-sdk-afs-1.0.0.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>aliyun</groupId>
            <artifactId>aliyun-java-sdk-core</artifactId>
            <version>3.0.6</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/lib/aliyun-java-sdk-core-3.0.6.jar</systemPath>
        </dependency>
        <!-- 导入云顿数据风控的jar END-->

打包

修改plugin中,添加配置<includeSystemScope>true</includeSystemScope>

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

可能出现的warning

[WARNING] Some problems were encountered while building the effective model for com.seniortech:beauty-hair-cms:jar:1.0.0
[WARNING] 'dependencies.dependency.systemPath' for aliyun:aliyun-java-sdk-afs:jar should not point at files within the project directory, ${basedir}/src/lib/aliyun-java-sdk-afs-1.0.0.jar will be unresolvable by dependent projects @ line 111, column 25
[WARNING] 'dependencies.dependency.systemPath' for aliyun:aliyun-java-sdk-core:jar should not point at files within the project directory, ${basedir}/src/lib/aliyun-java-sdk-core-3.0.6.jar will be unresolvable by dependent projects @ line 118, column 25
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.

解决方法,Use ${pom.basedir} instead of ${project.basedir}.

修改后的pom
   <!-- 导入云顿数据风控的jar -->
        <dependency>
            <groupId>aliyun</groupId>
            <artifactId>aliyun-java-sdk-afs</artifactId>
            <version>1.0.0</version>
            <scope>system</scope>
            <systemPath>${pom.basedir}/src/lib/aliyun-java-sdk-afs-1.0.0.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>aliyun</groupId>
            <artifactId>aliyun-java-sdk-core</artifactId>
            <version>3.0.6</version>
            <scope>system</scope>
            <systemPath>${pom.basedir}/src/lib/aliyun-java-sdk-core-3.0.6.jar</systemPath>
        </dependency>
        <!-- 导入云顿数据风控的jar END-->
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值