dimanche 14 décembre 2014

Grails, Maven and GSON : Could not find artifact


J'ai eu le problème suivant en voulant intégrer la librairie GSON à mon projet :

Error |
Resolve error obtaining dependencies: Could not find artifact com.google.code.gson:gson:zip:2.3.1 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)


La solution est très simple.Il faut mettre la dépendance dans dependencies et non dans plugin :

dependencies {
        // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
        runtime 'mysql:mysql-connector-java:5.1.24'
        compile 'com.google.code.gson:gson:2.3.1'
    }
Plus d'infos sur : http://stackoverflow.com/a/20974287/2473598