Springboot Maven 增加本地依赖包,Springboot Maven打包本地包
最近在脱离七牛的一些API,在做图片转换格式的时候, webp 格式处理上有点特殊,依赖 webp-imageio-core-0.1.0.jar 来处理,但是webp-imageio-core-0.1.0还没有发布 Maven 。
之前我发布过相关博客:
Springboot 打Jar包, Maven 完美解决本地Jar包自动打入Springboot Jar包中:https://www.sojson.com/blog/253.html
如何把自己的Jar包上传到 maven 官方仓库中, Maven 上传图文讲解:https://www.sojson.com/blog/250.html
下载Jar包,存放项目目录中
先下载Jar包,放到本地项目目录中,比如我放到了 resources 下新建了一个libs目录,把需要的jar包 copy 进去。
得到的目录为:$src/main/resources/libs/webp-imageio-core-0.1.0.jar
配置Maven pom文件
引入jar文件,指定lib目录。
<dependency>
<groupId>com.github.nintha</groupId>
<artifactId>webp-imageio-core</artifactId>
<version>0.1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/libs/webp-imageio-core-0.1.0.jar</systemPath>
</dependency>配置plugin、resource
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<extdirs>${project.basedir}/src/main/resources/libs</extdirs>
</compilerArguments>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
<includes>
<!--其他配置文件-->
<include>**/*.*</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<!-- jar 引入-->
<include>**/*.jar</include>
</includes>
</resource>
</resources>
</build>打包 Springboot 项目jar包 后用JD-GUI 等相关工具,或者解压jar 看看你想打包的jar 进去没,进去了就证明成功了。
版权所属:SO JSON在线解析
原文地址:https://www.sojson.com/blog/340.html
转载时必须以链接形式注明原始出处及本声明。
如果本文对你有帮助,那么请你赞助我,让我更有激情的写下去,帮助更多的人。
