-2

我正在寻找一个小时来找到我的问题的解决方案,我正在使用 maven to pom.xml 来查找此导入 org.springframework.jdbc.core.JdbcTemplate 的库

我的 pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.sample</groupId>
	<artifactId>test1</artifactId>
	<name> Spring boots test</name>
	<version>0.0.2-SNAPSHOT</version>
	<dependencies>
		<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
			<version>2.0.5.RELEASE</version>
		</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>3.2.1.RELEASE</version>
</dependency>
	</dependencies>
	<properties>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
		<java.version>1.8</java.version>
	</properties>

</project>

结果是:-

[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------------< org.sample:test1 >--------------------------
[INFO] Building Spring boots test 0.0.2-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/spring-jdbc/3.2.1.RELEASE/spring-jdbc-3.2.1.RELEASE.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.626 s
[INFO] Finished at: 2018-10-21T08:41:16+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project test1: Could not resolve dependencies for project org.sample:test1:jar:0.0.2-SNAPSHOT: Failed to collect dependencies at org.springframework:spring-jdbc:jar:3.2.1.RELEASE: Failed to read artifact descriptor for org.springframework:spring-jdbc:jar:3.2.1.RELEASE: Could not transfer artifact org.springframework:spring-jdbc:pom:3.2.1.RELEASE from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

4

1 回答 1

0

伙计,你可以做很多事情。

  • 检查 maven 存储库中的spring-boot-starterjarorg > springframework > boot

  • 有时下载可能会中断或可能由于失败而无法正确下载,在这种情况下删除spring-boot-starterorg > springframework > boot并重新构建

  • 您可以再次清理并验证 maven 项目(我建议从控制台执行此操作,为此请转到您pom.xml存在并执行的文件夹mvn clean verify

于 2018-10-21T06:09:30.870 回答