maven加载外部jar包 绝地灬酷狼 2024-04-06 09:34 24阅读 0赞 ## maven加载外部jar包 ## ![在这里插入图片描述][ed370a06bed446188169b202ce2302cf.png_pic_center] > pom文件 <!-- scope为system时,自动添加lib依赖包 --> <dependency> <groupId>FFmpeg</groupId> <artifactId>FFmpeg</artifactId> <version>1.0</version> <scope>system</scope> <systemPath>${basedir}/src/main/resources/lib/hk/FFmpeg-1.0.jar</systemPath> </dependency> <dependency> <groupId>examples</groupId> <artifactId>examples</artifactId> <version>1.0</version> <scope>system</scope> <systemPath>${basedir}/src/main/resources/lib/hk/examples.jar</systemPath> </dependency> <dependency> <groupId>jna</groupId> <artifactId>jna</artifactId> <version>1.0</version> <scope>system</scope> <systemPath>${basedir}/src/main/resources/lib/hk/jna.jar</systemPath> </dependency> <dependency> <groupId>com.xx.xxx</groupId> //组织,随便命名 <artifactId>***</artifactId> //包的名字,随便命名 <version>1.0.0</version> //版本,随便命名 <scope>system</scope> //scope为system时,自动添加lib依赖包 <systemPath>${basedir}/src/main/resources/lib/**.jar</systemPath> //路径,这里我jar在resources目录的lib文件夹下,也可以放在跟目标,路径按需修改 </dependency> > 项目打包问题 是由于项目打包时,不识别外部jar,又没有进行配置,继而导致出现问题。 <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <includeSystemScope>true</includeSystemScope> </configuration> </plugin> [ed370a06bed446188169b202ce2302cf.png_pic_center]: https://image.dandelioncloud.cn/pgy_files/images/2024/04/06/21fed3fdea8442d8a5084f4a10d3d29d.png
还没有评论,来说两句吧...