简体   繁体   中英

Gson dependency for grails

Hello I have following GSON dependency in my BuildConfig.Grooovy file

compile 'com.google.code.gson:gson:2.2.4'

and these repos

repositories {
        inherits true // Whether to inherit repository definitions from plugins

        grailsPlugins()
        grailsHome()
        mavenCentral()
        grailsCentral()
        mavenLocal()

        mavenRepo "http://repo1.maven.org/maven2/"
        mavenRepo "http://repo.grails.org/grails/libs-releases/"
}

This is a pretty basic question but I am getting following error and dont know how to fix it!

Resolve error obtaining dependencies: Could not find artifact com.google.code.gson:gson:zip:2.2.4 in mavenCentral (http://repo1.maven.org/maven2/) (Use --stacktrace to see the full trace)

What it looks like from the error message is that you have declared the dependency as a grails plugin inside plugins section.

//incorrect, hence it is looking for a .zip artifact instead of a .jar
plugins {
    compile 'com.google.code.gson:gson:2.2.4'
}

instead add it as a dependency

dependencies {
    compile 'com.google.code.gson:gson:2.2.4'
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM