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>