2013-12-19 63 views
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" 
} 
+0

的http:// stackoverflow.com/questions/7336107/how-do-i-avoid-could-not-determine-hibernate-dialect-for-database-name-h2 –

回答

0

我想你没有在MySQL WorkBench.Create新的模式名称创建新的模式,就像在DataSource.groovy中
文件