1.将jar添加到SpringBoot项目的resources文件下
pom.xml引用
<!--引入jar包 HtmlDownLoader.jar -->
<dependency>
<groupId>cn.lg</groupId>
<artifactId>html-downloader</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${project.basedir}/src/main/resources/lib/HtmlDownLoader.jar</systemPath>
</dependency>
如果我们想在打包时将该jar添加进去,需要而外声明
<!--打包时引入SystemScope级别-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
<includeSystemScope>true</includeSystemScope>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
2.将第三方jar修改为maven仓库中jar
wind+R输入cmd指令
mvn install:install-file
-Dfile=C:\Users\dell\Documents\work\HtmlDownLoader.jar \ #jar包位置
-DgroupId=cn.cat.code \ #设置groupId
-DartifactId=HtmlDownLoader \ #设置artifactId
-Dversion=1.0 \ #设置自版本号
-Dpackaging=jar \ #打包类型
-DgeneratePom=true #生成配置文件
【注】:artifactId 不能携带"-"等特殊符号,在引用时注意大小写
pom.xml引用
<dependency>
<groupId>cn.cat.code</groupId>
<artifactId>htmlDownLoader</artifactId>
<version>1.0</version>
</dependency>