0


Spring Boot 2.7.8以后mysql-connector-java与mysql-connector-j

错误信息

  1. 如果升级到Spring Boot 2.7.8,可以看到因为找不到mysql-connector-java依赖而出现错误。

配置:

  1. <parent>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-parent</artifactId>
  4. <version>2.7.14</version>
  5. <relativePath/> <!-- lookup parent from repository -->
  6. </parent>
  7. <dependencies>
  8. <dependency>
  9. <groupId>mysql</groupId>
  10. <artifactId>mysql-connector-java</artifactId>
  11. </dependency>
  12. </dependencies>

错误信息:

  1. [INFO] Scanning for projects...
  2. [ERROR] [ERROR] Some problems were encountered while processing the POMs:
  3. [ERROR] 'dependencies.dependency.version' for mysql:mysql-connector-java:jar is missing. @ line 54, column 15
  4. @
  5. [ERROR] The build could not read 1 project -> [Help 1]

原因

这是因为 Spring Boot 2.7.8 中 mysql-connector-java 不再由依赖管理来管理。

Release v2.7.8 · spring-projects/spring-boot · GitHub

处理

  1. 现有mysqlgroupIdmysql-connector-java是一个遗留形式,用一个单词“mysql”维护了很长时间。

https://blogs.oracle.com/mysql/post/mysql-connectorj-has-new-maven-coordinates

  1. 8.0.3120221014日发布)和8.0.322023118日发布)两个版本分别与mysql-connector-java/mysql-connector-j并行维护,今年春季boot 2.7.8 从那时起 mysql:mysql-connector-java 已从依赖管理中删除。

Maven Central Repository SearchOfficial search by the maintainers of Maven Central Repositoryhttps://search.maven.org/artifact/mysql/mysql-connector-java

Maven Central Repository SearchOfficial search by the maintainers of Maven Central Repositoryhttps://search.maven.org/artifact/com.mysql/mysql-connector-j

  1. 因此,从现在开始您可以使用 com.mysql:mysql-connector-j 依赖项。
  2. Spring Boot 2.7.8 起,更改 mysql:mysql-connector-java -> com.mysql:mysql-connector-j 并删除 mysql-connector-java 依赖管理
  1. <dependency>
  2. <groupId>com.mysql</groupId>
  3. <artifactId>mysql-connector-j</artifactId>
  4. </dependency>

参考

mysql:mysql-connector-java -> com.mysql:mysql-connector-j 변경 및 Spring Boot 2.7.8 이후 mysql-connector-java 의존성 관리 제거

标签: android

本文转载自: https://blog.csdn.net/yangyangye/article/details/131959080
版权归原作者 zzhongcy 所有, 如有侵权,请联系我们删除。

“Spring Boot 2.7.8以后mysql-connector-java与mysql-connector-j”的评论:

还没有评论