使用systemPath解决依赖问题
注意!使用systemPath的依赖在打包时一般不会被收录,需要配合插件完成打包。这里使用的是spring-boot-maven-plugin。
思路
- 指定依赖的scope为system
- 指定依赖的systemPath为
${pom.basedir}/jar包路径,其中${pom.basedir}是项目根路径 - 配置spring-boot-maven-plugin的includeSystemScope为true,收录本地jar包
示例
只有部分小节,使用时注意层级 ```xmlorg.json.simple json-simple 1.1.1 system ${pom.basedir}/libs/json-simple-1.1.1.jar com.xiaomi com.xiaomi 2.2.21 system ${pom.basedir}/libs/MiPush_SDK_Server_2_2_21.jar
……
<a name="HdXeM"></a>## 使用maven-install-plugin插件解决问题(未验证)<a name="xTKqo"></a>### 思路- 引入一个插件,绑定一个命令,这个命令可以把本地jar包安装到本地仓库中- 基本可以认为是mvn install的自动版- 如果绑定到生命周期,应该可以完全自动化<a name="5HMmk"></a>### 示例```xml<dependency><groupId>org.jbarcode</groupId><artifactId>jbarcode</artifactId><version>0.2.8</version></dependency>......<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-install-plugin</artifactId><version>2.5.2</version><executions><execution><id>install-external</id><phase>clean</phase><configuration><file>${basedir}/web/WEB-INF/lib/jbarcode-0.2.8.jar</file><repositoryLayout>default</repositoryLayout><groupId>org.jbarcode</groupId><artifactId>jbarcode</artifactId><version>0.2.8</version><generatePom>true</generatePom></configuration><goals><goal>install-file</goal></goals></execution></executions></plugin>
