2012-02-15 111 views
4

我正在嘗試grails-gradle插件和grails版本2.0。這裏是我的構建腳本:針對Grails 2.0的Grails/Gradle插件

buildscript { 
    repositories { 
     mavenRepo url: "http://repo.grails.org/grails/core/" 
    } 

    dependencies { 
     classpath "org.grails:grails-gradle-plugin:1.1.1-SNAPSHOT", 
        "org.grails:grails-bootstrap:2.0.0" 
    } 

    grailsVersion="2.0.0" 
} 

apply plugin: "grails" 

repositories { 
    mavenCentral() 
    mavenRepo url: "http://repo.grails.org/grails/core/" 
} 

dependencies { 
    compile "org.grails:grails:2.0.0", 
      "org.grails:grails-core:2.0.0", 
      "org.grails:grails-crud:2.0.0", 
      "org.grails:grails-datastore-core:1.0.2.RELEASE", 
      "org.grails:grails-datastore-gorm:1.0.2.RELEASE", 
      "org.grails:grails-hibernate:2.0.0", 
      "org.grails:grails-logging:2.0.0" 
} 

在腳本底部的依賴性比原來的「1.3.4」位於here不同。當我使用這個腳本創建一個帶有gradle grails-init的grails項目時,它可以正常工作,創建項目。當我嘗試使用gradle grails-run-app我收到以下錯誤:

~>gradle grails-run-app 
:grails-run-app 
| Configuring classpath 
| Error log4j:WARN No appenders could be found for logger (org.springframework.core.io.support.PathMatchingResourcePatternResolver). 
| Error log4j:WARN Please initialize the log4j system properly. 
| Error log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 
| Compiling 38 source files 

| Compiling 8 source files..... 
| Error Error: The following plugins failed to load due to missing dependencies: [hibernate] 
- Plugin: hibernate 
    - Dependencies: 
     ! dataSource (Required: 2.0 > *, Found: Not Installed) [INVALID] 
     - i18n (Required: 2.0 > *, Found: 2.0.0) 
     - core (Required: 2.0 > *, Found: 2.0.0) 
     - domainClass (Required: 2.0 > *, Found: 2.0.0) 

我假設,這意味着我缺少的依賴,但我不知道是什麼的依賴。它看起來像是hibernate是罪魁禍首,但我已經在上面包含了grails hibernate jar。這兩個Grails版本之間的jar列表是不同的,所以我不確定應該包含哪些jar文件(或者沒有一個,這是行不通的)。依賴關係列表可以參見here

任何幫助解決這些錯誤將不勝感激。

使用: 1.0的gradle,里程碑-7 &的grails 2.0.0

:依賴"org.grails:grails-gradle-plugin:1.1.1-SNAPSHOT"是最新修訂的從github本地副本。

回答

1

非常感謝。這是一個非常有用的線程,爲了回答你的問題,你需要在編譯時添加「org.grails:grails-plugin-datasource:2.0.1」,它解決了我的機器上的問題。

+0

我試過了,它仍然不適用於「grails-run-app」。它會初始化和組裝一個項目,但我無法運行它。 – jmq 2012-02-23 15:36:51

0

看起來你缺少一些依賴關係...查看Gradle/Grails application瞭解如何做到這一點的完整示例。

希望這會有所幫助!