Gab*_*ira 26 java maven spring-boot
我将Springboot版本更新到2.7.0,返回错误后:
\n描述:
\nAn attempt was made to call a method that does not exist. The attempt was made from the following location:\n\n org.webjars.WebJarAssetLocator.scanForWebJars(WebJarAssetLocator.java:183)\n\nThe following method did not exist:\n\n \'io.github.classgraph.ClassGraph io.github.classgraph.ClassGraph.acceptPaths(java.lang.String[])\'\n\nThe calling method\'s class, org.webjars.WebJarAssetLocator, was loaded from the following location:\n\n jar:file:/home/gabriel/.m2/repository/org/webjars/webjars-locator-core/0.50/webjars-locator-core-0.50.jar!/org/webjars/WebJarAssetLocator.class\n\nThe called method\'s class, io.github.classgraph.ClassGraph, is available from the following locations:\n\n jar:file:/home/gabriel/.m2/repository/io/github/classgraph/classgraph/4.8.69/classgraph-4.8.69.jar!/io/github/classgraph/ClassGraph.class\n\nThe called method\'s class hierarchy was loaded from the following locations:\n\n io.github.classgraph.ClassGraph: file:/home/gabriel/.m2/repository/io/github/classgraph/classgraph/4.8.69/classgraph-4.8.69.jar\n\n\nAction:\n\nCorrect the classpath of your application so that it contains compatible versions of the classes org.webjars.WebJarAssetLocator and io.github.classgraph.ClassGraph\nRun Code Online (Sandbox Code Playgroud)\n这是我的 pom.xml
\nAn attempt was made to call a method that does not exist. The attempt was made from the following location:\n\n org.webjars.WebJarAssetLocator.scanForWebJars(WebJarAssetLocator.java:183)\n\nThe following method did not exist:\n\n \'io.github.classgraph.ClassGraph io.github.classgraph.ClassGraph.acceptPaths(java.lang.String[])\'\n\nThe calling method\'s class, org.webjars.WebJarAssetLocator, was loaded from the following location:\n\n jar:file:/home/gabriel/.m2/repository/org/webjars/webjars-locator-core/0.50/webjars-locator-core-0.50.jar!/org/webjars/WebJarAssetLocator.class\n\nThe called method\'s class, io.github.classgraph.ClassGraph, is available from the following locations:\n\n jar:file:/home/gabriel/.m2/repository/io/github/classgraph/classgraph/4.8.69/classgraph-4.8.69.jar!/io/github/classgraph/ClassGraph.class\n\nThe called method\'s class hierarchy was loaded from the following locations:\n\n io.github.classgraph.ClassGraph: file:/home/gabriel/.m2/repository/io/github/classgraph/classgraph/4.8.69/classgraph-4.8.69.jar\n\n\nAction:\n\nCorrect the classpath of your application so that it contains compatible versions of the classes org.webjars.WebJarAssetLocator and io.github.classgraph.ClassGraph\nRun Code Online (Sandbox Code Playgroud)\n我可以解决这个问题吗?
\nAnd*_*son 43
的传递依赖项不兼容org.springdoc:springdoc-openapi-ui。这取决于两者org.webjars:webjars-core-locator,io.github.classgraph:classgraph但它们的版本不兼容。
Spring Boot 的依赖管理webjars-core-locator使用 version 0.50。webjars-core-locator 0.50默认情况下会使用classgraph 4.8.139,但由于 Maven 解决版本冲突的方式,它被降级为4.8.69.
您可以通过在现有的导入旁边4.8.139添加一些依赖项管理来恢复使用来解决该问题:pom.xmlspring-cloud-dependencies
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<version>4.8.139</version>
</dependency>
</dependencies>
</dependencyManagement>
Run Code Online (Sandbox Code Playgroud)
gla*_*ace 13
正如其他答案中所述,确实是 springdoc-openapi-ui 在这里制造麻烦。我遇到了有关 WebJarAssetLocator 和/或 ClassGraph 的各种错误,这些错误都通过更新 springdoc 解决了。
现在,有了 spring-boot 2.7.2 和 spring-doc 1.6.9,一切又恢复顺利了。
| 归档时间: |
|
| 查看次数: |
36361 次 |
| 最近记录: |