2014-01-07 36 views
0

GSON依賴於你好我在BuildConfig.Grooovy文件下列GSON依賴的Grails

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

這些回購

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/" 
} 

這是一個非常基本的問題,但我得到下面的錯誤並且不要知道如何解決它!

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) 

回答

3

從錯誤消息看來,您已經聲明瞭依賴作爲插件部分中的grails插件。

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

,而不是將其添加爲一個依賴

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

這已經不是我凌晨3點!那是一位新秀 – Sap