SpringBoot导包坑之spring-boot-starter-parent

在新建springboot项目里,有几率从远程仓库下载jar包出错,导致jar包无法导入.即使我把相关的包都删完,都不行,要么换个仓库,要么换个版本.下面给出两个比较便利的方法

<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.1.0.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>

百度有两个解决方案

方式一:

因为你未配置maven镜像使用的是默认的,建议在maven的setting中配置国内镜像;

百度有很多镜像的配置方案;

我已经配置,然后发现仍不可以..这就比较郁闷了

方式二:

在pom.xml后面添加如下代码,然后保存pom.xml文件,就会重新引入jar包

    <repositories>
		<repository>
			<id>spring-snapshots</id>
			<url>http://repo.spring.io/libs-snapshot</url>
		</repository>
	</repositories>

	<pluginRepositories>
		<pluginRepository>
			<id>spring-snapshots</id>
			<url>http://repo.spring.io/libs-snapshot</url>
		</pluginRepository>
	</pluginRepositories>

猜你喜欢

转载自blog.csdn.net/weixin_42236404/article/details/84073969