两种方法:

1、Idea打包

IDEA打包,天然包含引入的本地 jar 包。参考链接

2、maven打包

(1)在pom.xml文件中写入本地jar的依赖

<dependency>
    <groupId>com.xhj</groupId>
    <artifactId>sdk-xhj</artifactId>
    <version>1.1.2</version>
    <scope>system</scope>//注意这里一定要写成system,为了系统引入打包
    <systemPath>${project.basedir}/lib/sdk-xhj-1.1.2.jar</systemPath> //${project.basedir}项目根地址
</dependency>

(2)在pom.xml中配置打包插件

<plugin>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-maven-plugin</artifactId>
   		<executions>
   			<execution>
                <goals>
                    <goal>repackage</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <includeSystemScope>true</includeSystemScope>//重点就是这,表示打包时包含全局的jar包
        </configuration>
 </plugin>

(3)点击 mvn package打包即可

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐