2013-04-20 95 views
1

我试图在运行的gradle下面的命令,它给了我下面的错误JDBC连接:无法获得数据源

c:\gsoc\mifosx\mifosng-provider>gradle migrateTenantListDB -PdbName=mifosplatfor 
m-tenants 
Listening for transport dt_socket at address: 8005 
:migrateTenantListDB FAILED 

FAILURE: Build failed with an exception. 

* Where: 
Build file 'C:\gsoc\mifosx\mifosng-provider\build.gradle' line: 357 

* What went wrong: 
Execution failed for task ':flywayMigrate'. 
> Unable to obtain Jdbc connection from DataSource 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug 
option to get more log output. 

BUILD FAILED 

Total time: 13.843 secs 

脚本文件是在这里,行不。的错误显示为357,但我不知道它为什么会显示错误。它说的是关于不正确配置MySQL服务器,请帮我在这里: 脚本:

task migrateTenantListDB<<{ 
    description="Migrates a Tenant List DB. Optionally can pass dbName. Defaults to 'mifosplatform-tenants' (Example: -PdbName=someDBname)" 

    def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/list_db' 
    def tenantsDbName = 'mifosplatform-tenants'; 
    if (rootProject.hasProperty("dbName")) { 
     tenantsDbName = rootProject.getProperty("dbName") 
    } 

    flyway.url= "jdbc:mysql://localhost:3306/$tenantsDbName" 
    flyway.locations= [filePath] 

    flywayMigrate.execute() 
} 
+0

我从来没有使用gradle,但我会建议您使用--stacktrace重新编译,就像错误消息推荐的一样,以便您可以获得关于为什么事情没有编译的提示。我还建议你指出哪一行是留置权357,以帮助人们开始寻找。 – atk 2013-04-20 07:30:10

+0

不要直接调用任务,尝试将任务类型设置为飞行迁移和前期配置。您可能忘记将mysql驱动程序放在类路径中,因此插件无法加载它 – 2013-04-20 08:02:56

回答

0

该项目的gradle这个剧本已经得到了MySQL的密码硬编码到MySQL。您需要将您的localhost密码设置为mysql,并在尝试执行此命令之前检查连接。