运行springboot项目时出现的问题:Failed to resolve org.junit.platform:junit-platform-launcher:1.5.2

解决方案:

1、确保pom.xml文件中对Junit的依赖存在,没有添加如下:

<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>org.junit.vintage</groupId>
					<artifactId>junit-vintage-engine</artifactId>
				</exclusion>
			</exclusions>
</dependency>

2、确保Maven的配置文件即settings.xml文件中的下载地址正确,我的下载地址如下:

<!-- 阿里云镜像 -->
		<mirror>
			<id>alimaven</id>
			<name>aliyun maven</name>
			<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
			<mirrorOf>central</mirrorOf>
		</mirror>
		<mirror>
			<id>central</id>
			<name>Maven Repository Switchboard</name>
			<url>http://repo1.maven.org/maven2/</url>
			<mirrorOf>central</mirrorOf></mirror>
		<mirror>
			<id>repo2</id>
			<mirrorOf>central</mirrorOf>
			<name>Human Readable Name for this Mirror.</name>
			<url>http://repo2.maven.org/maven2/</url></mirror>
		<mirror>
		<id>ibiblio</id>
			<mirrorOf>central</mirrorOf>
			<name>Human Readable Name for this Mirror.</name>
			<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
		</mirror>
<!-- 中央仓库在中国的镜像 -->
		<mirror>
			<id>maven.net.cn</id>
			<name>oneof the central mirrors in china</name>
			<url>http://maven.net.cn/content/groups/public/</url>
			<mirrorOf>central</mirrorOf>
		</mirror>

3、最后一个比较奇葩的问题,可能是网络问题!!!我就是用家里的网络在自动下载一些文件的时候卡壳,最后出现的上述错误。一定要注意,最后换了手机热点成功的。

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐