-
pom中引入本地jar包
- 在项目目录下新建libs文件夹,然后将所需jar包放置该文件下。
-
编辑pom文件,增加以下内容:【xxx内容根据实际内容替换即可】
-
<dependency> <groupId>xxxxxx</groupId> <artifactId>xxxx</artifactId> <version>xxx</version> <scope>system</scope> <systemPath>${pom.basedir}/libs/xxxxx.jar</systemPath> </dependency>
-
-
基于上面几个步骤,是可以在本地进行开发使用的,但有可能出现编译为jar包后,启动时发现找不到第三方jar包的位置。
-
可以尝试以下方法,还是在pom.xml文件中,
增加一行配置
,使其在编译jar包时加载系统范围内的包。-
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.3.9.RELEASE</version> <configuration> <includeSystemScope>true</includeSystemScope> </configuration> </plugin>
-
-
版权声明:本文为lihangll原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。