引入本地jar
- <dependency>
- <groupId>com.abc</groupId>
- <artifactId>bbb</artifactId>
- <version>1.0.0</version>
- <scope>system</scope>
- <systemPath>${project.basedir}/libs/bbb-1.0.0.jar</systemPath>
- </dependency>
${project.basedir}表示项目所在根目录
打包成jar
给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>
打包命令:mvn clean package
如果jar包已经安装到本地仓库,则无需增加includeSystemScope参数。