Dependency management: libraries

Adding GSON library in Gradle for build automation

Report a typo

Imagine you are working on a Java project in IntelliJ IDEA and you have decided to use Gradle for build automation. You need to include the GSON library, which is a Java library that can be used to convert Java Objects into their JSON representation. You want to use version 2.8.5 of this library. You've written a Gradle script, but some parts are missing. Please fill the blanks in the code to properly add a dependency on the GSON library to your project.

Fill in the gaps with the relevant elements
apply plugin: ''

 {
    mavenCentral()
}

 {
     'com.google.code.gson:gson:2.8.5'
}

task printVersion {
    doLast {
        println "The GSON library version is 2.8.5"
    }
}
java-libraryrepositoriesimplementationdependencies
___

Create a free account to access the full topic