0
votes

I have spring-boot-starter in my POM and versions are automatically resolved by Camden dependency management system.

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Camden.SR6</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

  <dependencies>    
    <!-- Spring Boot -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>
 </dependencies>

This gives me version 1.4.3.RELEASE of spring-boot-starter.

One of the jars spring boot starter includes automatically in the maven dependencies is logback-classic: 1.1.18

ch.qos.logback_logback-core version 1.1.8 has a vulnerability because of which I want to switch over to logback version 1.2 This vulnerability is explained in the link below

https://nvd.nist.gov/vuln/detail/CVE-2017-5929

Now, is there a way to override the logback version to 1.2 from what spring-boot-starter automatically resolves it to so that I am not exposed to this vulnerability ?

2
It depends. If you use the spring-boot-starter-parent as the parent of your project it is as easy as defining the version you want in the properties section else add it in the dependencyManagement section to override the other versions set. - M. Deinum

2 Answers

3
votes

Based on your pom file, you can achieve this by excluding the dependency of 1.1.8 first then add the dependency of 1.2.0.
For example:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
    <exclusions>
        <exclusion>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.2.0</version>
</dependency>
0
votes

add properties tag in pom like this

<properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <start-class>org.roshan.Application</start-class>
        <hibernate.version>5.2.10.Final</hibernate.version>
        <liquibase.version>3.5.3</liquibase.version>
        <liquibase-hibernate5.version>3.6.0</liquibase-hibernate5.version>
        <httpcore.version>4.4.5</httpcore.version>
        <httpclient.version>4.5.3</httpclient.version>
        <docker-maven-plugin.version>0.4.13</docker-maven-plugin.version>
    </properties>