aioobe
aioobe

Reputation: 421090

Figuring out which Jersey version Dropwizard depends on in Gradle

Is there an automated way to find out which version of Jersey that Dropwizard depends on?

I'd like to add jersey-apache-connector as a dependency to my project. To make sure it's compatible with the Jersey version included through Dropwizard, I'd like to do something like

compile "org.glassfish.jersey.connectors:jersey-apache-connector:$dropwizardJacksonVersion"
                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^

dropwizardJacksonVersion obviously doesn't exist. Is there a simple way solve this programatically?

(I realize I could find out a good version number manually, but it would be nice to just depend on a specific version of Dropwizard, and just follow suit when it comes to Jersey versions.)

Upvotes: 1

Views: 720

Answers (1)

Roman Ivanitsky
Roman Ivanitsky

Reputation: 121

For this purpose you can use Dropwizard BOM.

group 'teestBom'
version '1.0-SNAPSHOT'

buildscript {
    repositories {
        mavenCentral()

    }
    dependencies {
        classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
    }
}


repositories {
    mavenCentral()

}

apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
sourceCompatibility = 1.8

dependencyManagement {
    imports {
        mavenBom 'io.dropwizard:dropwizard-bom:1.2.0'
    }
}


dependencies {
    compile "org.glassfish.jersey.connectors:jersey-apache-connector"
}

And you not need to define a version of jersey-apache-connector or other libraries, that define in dropwizard bom.

Upvotes: 1

Related Questions