0
我正在使用下面的gradle構建腳本來測試示例應用程序。Gradle/Grails gradle grails-run-app命令失敗
使用這個腳本運行gradle這個init命令,然後
gradle這個Grails的運行,應用程序
命令它編譯,但未能與此消息。 「無法確定數據庫名稱的Hibernate方言[H2]!」
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreat
ionException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested
exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProper
ties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hib
ernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.spr
ingframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.codehaus.gr
oovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect for database name [H2]!
但是,如果我運行grails run-app,它的工作原理。看起來像是從gradle.build文件中缺少的東西。你能幫我解決這個錯誤信息嗎?
gradle -v
------------------------------------------------------------
Gradle 1.10
------------------------------------------------------------
Build time: 2013-12-17 09:28:15 UTC
Build number: none
Revision: 36ced393628875ff15575fa03d16c1349ffe8bb6
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy: 2.2.0
JVM: 1.6.0_24 (Sun Microsystems Inc. 20.0-b12)
OS: Linux 2.6.32-358.23.2.el6.i686 i386
構建腳本:
cat build.gradle
buildscript {
repositories {
mavenCentral()
maven { url 'http://repo.grails.org/grails/repo' }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:2.0.0-SNAPSHOT"
}
}
repositories {
mavenCentral()
maven { url 'http://repo.grails.org/grails/repo' }
}
version = "1.0"
apply plugin: "grails"
apply plugin: 'idea'
grails {
grailsVersion = "2.3.4"
}
dependencies {
['dependencies', 'core', 'spring', 'web', 'plugin-datasource', 'plugin-domain-class', 'plugin-controllers', 'plugin-services'].each { plugin ->
compile "org.grails:grails-$plugin:2.3.2"
}
compile 'org.grails.plugins:tomcat:7.0.47'
compile 'org.grails.plugins:hibernate:3.6.10.6'
compile 'com.h2database:h2:1.3.173'
bootstrap "org.codehaus.groovy:groovy-all:2.1.9"
}
的http:// stackoverflow.com/questions/7336107/how-do-i-avoid-could-not-determine-hibernate-dialect-for-database-name-h2 –