springboot引入第三方jar包
1.第一步,创建springboot工程
File->Peoject->Springboot lnitializr
选择一个web项目
选择项目存放目录Finish
2.在resources目录下新建lib文件夹
放入你要引入的第三方jar并且选中jar右键Add ad library
3.pom配置
groupId,artifactId,version可随便写 systemPath路径一定要指定全路径
<!--引入第三方jar包-->
<dependency>
<groupId>com.qrcode</groupId>
<artifactId>qrcode</artifactId>
<version>1.8</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/QRCode.jar</systemPath>
</dependency>
<!--mavean打包配置将includeSystemScope设置为true-->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
4.测试
@RestController
public class QrcodeTest {
@RequestMapping("/code")
public void qrcodeTest(){
//这个就是刚引入的jar
Qrcode qrcode = new Qrcode();
System.out.println(qrcode);
}
}
结果:输出jar对象地址
5.mavean打jar包
命令:mvn clean && mvn compile && mvn package && start target
5.mavean打jar包
命令:mvn clean && mvn compile && mvn package && start target