springboot maven 使用本地仓库打包
1222
0
0
1年前
## 业务环境:springboot使用本地jar打包
设置的setting文件中镜像指向阿里云
```
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
```
但是本地的jar包无法从阿里云下载
解决步骤:
1.将本地jar打到本地仓库:maven install
解释:可以将项目本身编译并打包到本地仓库,这样其他项目引用本项目的jar包时不用去私服上下载jar包,直接从本地就可以拿到刚刚编译打包好的项目的jar包
2.pom文件修改
a.引入本地依赖
```
<dependency>
<groupId>jave-last</groupId>
<artifactId>jave</artifactId>
<version>1.0.2</version>
<scope>system</scope>
<systemPath>D:/mavenlocalReposity/jave-last/jave/1.0.2/jave-1.0.2.jar</systemPath>
</dependency>
```
b.修改打包插件
```
<!--maven打包插件-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- 同时发布本地引用包 -->
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
```