1. 通过dependency引入
在项目根路径新建lib文件夹,把jar包扔进去
配置pom.xml
<!-- 导入敏感词匹配包 -->
<dependency>
<groupId>com.hctrl</groupId>
<artifactId>word-spring-boot-start</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>system</scope> <!--system,类似provided,需要显式提供依赖的jar以后,Maven就不会在Repository中查找它-->
<systemPath>${project.basedir}/lib/word-spring-boot-start-0.0.1-SNAPSHOT.jar</systemPath>
</dependency>
光是上面的配置,打包是进不去的。在spring-boot-maven-plugin 添加true
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
<executions>
<execution>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
2. 将外部jar打入本地maven仓库
mvn install:install-file
-Dfile=D:\software\maven_repo\org\postgresql\hgjdbc\6.0.3-SNAPSHOT\hgjdbc-6.2.0.jar
-DgroupId=org.postgresql
-DartifactId=hgjdbc
-Dversion=6.0.3-SNAPSHOT
-Dpackaging=jar
对应的maven配置
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>hgjdbc</artifactId>
<version>6.0.3-SNAPSHOT</version>
</dependency>