我想(重新)使用命令“schema-export”创建我的数据库模式。DDL 生成工作正常,但如果我执行“模式导出导出”,我会收到以下错误,这表明配置文件中缺少某些内容。
grails> dev schema-export export
| Compiling 1 source files.....
Exporting in environment 'development' for the default DataSource
| Error 2012-08-24 14:45:57,466 [main] ERROR hbm2ddl.SchemaExport - schema export unsuccessful
Message: No local DataSource found for configuration - 'dataSource' property must be set on LocalSessionFactoryBean
Line | Method
->> 61 | doCall in SchemaExport$_run_closure1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| Error 2012-08-24 14:45:57,472 [main] ERROR hbm2ddl.SchemaExport - schema export unsuccessful
Message: No local DataSource found for configuration - 'dataSource' property must be set on LocalSessionFactoryBean
Line | Method
->> 64 | doCall in SchemaExport$_run_closure1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
我的 DataSource.groovy 定义了一个“数据源”:
dataSource {
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
}
...
environments {
development {
dataSource {
username = "xxx"
password = "yyy"
url = "jdbc:mysql://localhost:3306/chrono_dev?autoreconnect=true"
}
}
...
}
任何建议如何解决此错误?