Guava version (FluentIterable) - ошибка старта приложения
Ранее в зависимостях (использую maven с pom.xml) была зависимость на Guava с версией 15.0, подключил Swagger:
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
и теперь при старте приложения (SpringBoot версия 2.2.5) оно падает с ошибкой:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
springfox.documentation.schema.DefaultModelDependencyProvider.dependentModels(DefaultModelDependencyProvider.java:79)
The following method did not exist:
com.google.common.collect.FluentIterable.concat(Ljava/lang/Iterable;Ljava/lang/Iterable;)Lcom/google/common/collect/FluentIterable;
The method's class, com.google.common.collect.FluentIterable, is available from the following locations:
jar:file:/C:/Users/ME/.m2/repository/com/google/javascript/closure-compiler/v20151216/closure-compiler-v20151216.jar!/com/google/common/collect/FluentIterable.class
jar:file:/C:/Users/ME/.m2/repository/com/google/guava/guava/21.0/guava-21.0.jar!/com/google/common/collect/FluentIterable.class
It was loaded from the following location:
file:/C:/Users/ME/.m2/repository/com/google/javascript/closure-compiler/v20151216/closure-compiler-v20151216.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.google.common.collect.FluentIterable
Похожую проблему я нашел и решения на нее тоже (не помогли):
- Сменил версию Guava на 20.0
- Удалил локальный jar, выкачал заново
- Удалил конфигурационный класс сваггера, заработало, но тогда у меня не будет сваггера))
Однако нашел ответ с использованием принудительной версии Guava на Gradle:
configurations.all {
resolutionStrategy.force "com.google.guava:guava:$guavaVersion"
}
К сожалению, у меня Maven и пока я не нашел похожего функционала в нем.
Вопрос - как можно решить эту проблему? Или стоит переехать на третий сваггер и там оно все само-собой решится?
Ответы (1 шт):
Решено: Помогло переехать на новую версию сваггера (2.10.5)
Не знаю насколько это хорошее решение, но работает. Думаю, наиболее лучшим будет переезд на версию 3.0.0
upd: по итогу сменил версию на 3.0.0