缺少工件javax .validation:validation-api:jar:2.0.1 final

时间:2018-10-06 12:02:04

标签: spring maven dependencies

我为spring-boot-starter-data-jpaspring-boot-starter-jdbcmysql-connector-java添加了依赖性。

我遇到了问题:"missing artifact javax .validation:validation-api:jar:2.0.1 final.

我该如何解决?

3 个答案:

答案 0 :(得分:6)

从版本2.3.0.RELEASE开始,Spring Boot Web和WebFlux启动器不再依赖于验证启动器,应将spring-boot-starter-validation明确地添加到pom.xml中。

Spring Boot 2.3 Release Notes

答案 1 :(得分:2)

确保pom中具有spring-boot-starter-web依赖项,因为javax.validation是其中的一部分。然后运行mvn clean install一次以重新加载所有依赖项。

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

在此处查看网络依赖关系树。.javax.validation:validation-api:jar:2.0.1.Final

org.springframework.boot:spring-boot-starter-web:jar:2.0.4.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.0.4.RELEASE:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.6:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.9.6:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.6:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.6:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.6:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.0.4.RELEASE:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.32:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.32:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.32:compile
[INFO] |  +- org.hibernate.validator:hibernate-validator:jar:6.0.11.Final:compile
[INFO] |  |  \- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] |  +- org.springframework:spring-web:jar:5.0.8.RELEASE:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:5.0.8.RELEASE:compile
[INFO] |     \- org.springframework:spring-expression:jar:5.0.8.RELEASE:compile

答案 2 :(得分:0)

这就是我解决问题的方法:

<dependency>
    <groupId>javax.validation</groupId>
    <artifactId>validation-api</artifactId>
    <version>2.0.1.Final</version>
</dependency>

Here the dependency