0

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.

Xy.dht
  • 1

1 Answers1

0

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

Ashish
  • 83
  • 7
  • I try to remove the dependency `spring-data-redis` ,but it does not work. then i use `mvn help:effective-pom`, **in addition to ** ` org.apache.commons commons-pool2 2.4.2 ` **there are** ` commons-pool commons-pool 1.6 ` mybe it have an imapct? – Xy.dht Jul 15 '22 at 22:59