Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is the maven version specified in Spring Boot Starters?

I'm read the reference but I don't understand how versionId is set in the dependency. For example the MongoDB starter specifies

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-mongodb</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.mongodb</groupId>
                    <artifactId>mongo-java-driver</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>jcl-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

But the version tag is missing. How is the version of mongodb-driver determined when using these starts?

like image 302
Nic Cottrell Avatar asked Mar 07 '23 05:03

Nic Cottrell


1 Answers

The versions of the starter atrifacts are managed in the starter parent. For example, if you have this in your POM:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.2.RELEASE</version>
</parent>

Then any boot starter dependency you reference will have version 2.0.2.RELEASE, unless you override the default and provide your own version for some reason.

like image 199
Michael Peacock Avatar answered Mar 19 '23 20:03

Michael Peacock