2012-08-31 35 views
7

我想在我的(Grails)項目中包含Apache commons-math 3.0。所以,我把我的依賴關係如下:Gradle搜索zip而不是jar

compile "org.apache.commons:commons-math3:3.0" 

這是在中央Maven倉庫,看到http://central.maven.org/maven2/org/apache/commons/commons-math3/3.0/

搖籃給我的錯誤

:::::::::::::::::::::::::::::::::::::::::::::: 

    ::    FAILED DOWNLOADS   :: 

    ::^see resolution messages for details^:: 

    :::::::::::::::::::::::::::::::::::::::::::::: 

    :: org.apache.commons#commons-math3;3.0!commons-math3.zip 

    :::::::::::::::::::::::::::::::::::::::::::::: 

和他人之間包括:

==== mavenCentral: tried 

    http://repo1.maven.org/maven2/org/apache/commons/commons-math3/3.0/commons-math3-3.0.zip 

所以它看起來是在正確的地方,但爲什麼它lo爲拉鍊而不是罐子? Gradle doco說那個jar是搜索的默認東西。我甚至試着用@符號使用「artifact only notation」來獲得jar(如http://gradle.org/docs/current/userguide/dependency_management.html所述),但它仍然只搜索zip。

+0

您是否使用Gradle的舊版本(之前的版本)?我建議嘗試1.1。 –

+0

@PeterNiederwieser Grails 2.1 - 最新版本。 – Fletch

+0

我要求_Gradle_版本。或者你在使用Grails的內置構建系統嗎?在這種情況下,這不是一個Gradle問題。 –

回答

24

如果您使用Grails的BuildConfig.groovy進行解析,則有兩個依賴關係解析塊,即dependencies塊和plugins塊。確保您的聲明位於dependencies區塊內。如果意外放置在plugins塊中,它將查找打包的插件,打包爲.zip文件。

+0

啊哈!謝謝。 – Fletch

相關問題