Package org.apache.commons.pool2.impl does not exist

714 Views Asked by At

when i use this maven project,mvn install .

[ERROR] hint

Package org.apache.commons.pool2.impl does not exist

error

pom.xml about redis

        <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-redis</artifactId>
                <exclusions>
                    <exclusion>
                        <groupId>org.springframework.data</groupId>
                        <artifactId>spring-data-redis</artifactId>
                    </exclusion>
                </exclusions>


            </dependency>

            <dependency>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-redis</artifactId>
                <version>1.8.23.RELEASE</version>
            </dependency>
        <dependency>
                <groupId>org.crazycake</groupId>
                <artifactId>shiro-redis</artifactId>
                <version>2.8.20</version>
            </dependency>

i saw org.apache.commons.pool2 has been downloaded in maven repo.

package has been downloaded

but external libraries in idea does not have this package

but not in dependency and libraries

i try to put package commons.pool2 into project structure ->libraries,then when i reload maven project ,the package org.apache.commons.pool2 is missing from libraries and modules

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

is useless,some new error will be happened in project.

1

There are 1 best solutions below

1
On

As I see that you are excluding spring-data-redis from spring-boot-starter-data-redis.

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-data-redis</artifactId>
    <exclusions>
      <exclusion>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-redis</artifactId>
      </exclusion>
    </exclusions>
</dependency>

Why are adding it back again with defined version

<dependency>
  <groupId>org.springframework.data</groupId>
  <artifactId>spring-data-redis</artifactId>
  <version>1.8.23.RELEASE</version>
</dependency>

The spring-data-redis contains org.apache.commons » commons-pool2

Remove both the <exclusion> and the spring-data-redis dependency

You can also try below commands to get the dependency structure

mvn dependency:tree
mvn help:effective-pom

and look for commons-pool2,maybe something will draw your attention like excludes or dependency overrides