修改spring-boot-starter-data-redis依赖后,spring-data-redis版本为何不符预期?
问题:自定义spring-boot-starter-data-redis版本后,spring-data-redis版本未按预期生效
我修改了spring-boot-starter-data-redis的pom.xml文件,将spring-data-redis的版本指定为2.1.4.RELEASE,重新编译该starter为2.1.19.BUILD-SNAPSHOT版本并执行本地安装命令mvn clean install -DskipTests,随后在新项目fm_hello中引用该版本的spring-boot-starter-data-redis。但发现实际使用的spring-data-redis版本为2.1.21.RELEASE,而非预期的2.1.4.RELEASE。
相关配置信息
1. 修改后的spring-boot-starter-data-redis的pom.xml片段
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-redis</artifactId> <version>2.1.4.RELEASE</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>io.lettuce</groupId> <artifactId>lettuce-core</artifactId> </dependency>
2. fm_hello项目中引入spring-boot-starter-data-redis的配置
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>2.1.19.BUILD-SNAPSHOT</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <version>2.1.19.BUILD-SNAPSHOT</version> </dependency> </dependencies>
3. fm_hello项目的完整pom.xml文件
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.unicom.fm.hello</groupId> <artifactId>fm_hello</artifactId> <version>1.0.0</version> <name>fm_hello</name> <description>Redis SDK Test</description> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-parent</artifactId> <version>2.1.19.BUILD-SNAPSHOT</version> <relativePath/> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>2.1.19.BUILD-SNAPSHOT</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <version>2.1.19.BUILD-SNAPSHOT</version> </dependency> </dependencies> <repositories> <repository> <id>local-repo</id> <url>C:\Users\huzh3\.m2\repository</url> </repository> </repositories> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.4.0</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18.1</version> <configuration> <testFailureIgnore>true</testFailureIgnore> </configuration> </plugin> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.8.1</version> <executions> <execution> <id>default-prepare-agent</id> <goals> <goal>prepare-agent</goal> </goals> <configuration> <destFile> ${project.build.directory}/coverage-reports/jacoco.exec </destFile> <propertyName>surefireArgLine</propertyName> </configuration> </execution> <execution> <id>default-report</id> <phase>test</phase> <goals> <goal>report</goal> </goals> <configuration> <dataFile>${project.build.directory}/coverage-reports/jacoco.exec</dataFile> <outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>
项目依赖截图

期望
我期望在fm_hello项目中引入2.1.19.BUILD-SNAPSHOT版本的spring-boot-starter-data-redis后,底层使用的spring-data-redis版本为2.1.4.RELEASE。
内容的提问来源于stack exchange,提问作者User9527
相关产品推荐
相关产品推荐

