在开发过程中如果遇到pom文件中依赖的jar包在仓库中没有找到而报错的情况,一般有两种解决办法。
一是从网上下载相应版本的jar包放到本地仓库中的相应位置
二是把jar包放到项目中的,然后在pom中设置依赖本地jar包,方法如下:
先在maven插件处加入<includeSystemScope>true</includeSystemScope>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
再修改jar包的引用来源:
<dependency>
<groupId>com.test</groupId>
<artifactId>test-utils</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/test-utils-1.0.0.jar</systemPath>
</dependency>
当Maven在仓库找不到jar包时,可以将jar包放入本地仓库或直接在项目中引用。通过在spring-boot-maven-plugin配置includeSystemScope为true,然后在pom.xml中使用systemscope定义依赖,指定jar包在项目中的路径。
2699

被折叠的 条评论
为什么被折叠?



