错误

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/pool2/impl/GenericObjectPoolConfig

解决方案

以下配置都是在pom.xml里配置。

配置依赖

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-pool2</artifactId>
    <version>2.0</version>
</dependency>

配置maven-plugin

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.0.0</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <!--<minimizeJar>true</minimizeJar>-->
                <artifactSet>
                    <includes>
                        <include>redis.clients:jedis</include>
                        <include>org.apache.commons:commons-pool2</include>
                    </includes>
                </artifactSet>
                <relocations>
                    <relocation>
                        <pattern>com.google.common</pattern>
                        <shadedPattern>shaded.com.google.common</shadedPattern>
                    </relocation>
                </relocations>
            </configuration>
        </execution>
    </executions>
</plugin>