Solve guava dependency version conflict The following method did not exist: FluentIterable.class

Solve the conflict between shardingsphere and guava dependency version before swagger2

Cause of conflict

<dependency>
    <groupId>io.shardingjdbc</groupId>
    <artifactId>sharding-jdbc-core</artifactId>
    <version>2.0.3</version>
</dependency>

The jar imported by the pom above, so the guava version is 18.0

The following swagger2 jar depends on guava version 20.0

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>2.9.2</version>
</dependency>

Conflict resolution

Ignore the low version of guava (considering that the high version is compatible with the low version), the code is as follows, add the following tag to the pom of shardingjdbc to ignore the guava that the jar depends on.

<dependency>
    <groupId>io.shardingjdbc</groupId>
    <artifactId>sharding-jdbc-core</artifactId>
    <version>2.0.3</version>
       <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
</dependency>

Summary of ideas

Applies to most of these conflicts:

  1. First locate the cause of the conflict ----->guava version conflict
  2. Determine the cause of the conflict ------> swagger2 and shardingjdbc
  3. Comprehensive considerations----->shield a lower version

Guess you like

Origin blog.csdn.net/m0_47220500/article/details/105789770