1

I have a project, where I use spring-cloud-starter-stream-rabbit. But our devOps team asked me why I'm using spring-web. I've figured out that spring-web goes exactly from spring-cloud-starter-stream-rabbit. But there is no version defined:

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-web</artifactId>
</dependency>

I've started to look in parent projects. But with no result. pom hierarchy

I go from bottom to top:

spring-cloud-stream-binder-rabbit-core.pom

spring-cloud-stream-binder-rabbit-parent.pom

spring-cloud-build.pom

Surprisingly I cant find version there. I thought maybe this versions goes from other dependencies. Created project with single dependency like this

<?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>org.example</groupId>
    <artifactId>example</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
            <version>3.1.2</version>
        </dependency>
    </dependencies>
</project>

But mvn dependency:list showed:

...
[INFO]    com.fasterxml:classmate:jar:1.3.4:compile
[INFO]    org.springframework:spring-web:jar:5.3.4:compile
[INFO]    javax.annotation:javax.annotation-api:jar:1.3.2:compile
...

Wow! Where is that secret place where maven gets version for spring-web? If you know please help.

Thanks for support!

Mark Tielemans
  • 1,528
  • 3
  • 20
  • 40
  • 2
    It is defined in the parent, which includes an import of a certain Spring Boot version which in turn imports the proper Spring Boot version. Just how maven works. – M. Deinum Jun 17 '21 at 05:45
  • Thank you for answer. But i've looked in spring-boot-dependencies, and i haven't found any spring-web version. https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-dependencies/2.4.5/spring-boot-dependencies-2.4.5.pom – Windwail128 Qwe Jun 17 '21 at 06:02
  • Correct, as it itself import the `spring-framework-bom` which contains all Spring Framework dependencies. (https://stackoverflow.com/questions/14874966/how-to-use-bom-file-with-maven) – M. Deinum Jun 17 '21 at 06:07

0 Answers0