1、首先新建libs文件夹,把外部依赖的jar放进去。
2、在pom文件把外部依赖jar文件导进去
<dependency>
    <groupId>org.codehaus.stax2</groupId>
    <artifactId>stax2</artifactId>
    <version>3.1.4</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/libs/stax2-api-3.1.4.jar</systemPath>
</dependency>
 其中groupId、artifactId和version都可以自己定义  scope是system,和provided类似,只是jar包本地提供,这种方式有个缺点,那就是在项目打成jar或war包的时候因为scope是system,只在编译的时候能用,install的时候不会打进去。 
在pom中给spring boot的打包插件设置一下includeSystemScope参数即可?
|  | <build>
 <plugins>
 <plugin>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-maven-plugin</artifactId>
  <configuration>
   <includeSystemScope>true</includeSystemScope>
  </configuration>
 </plugin>
 </plugins>
 </build> |