【发布时间】:2013-12-24 12:17:02
【问题描述】:
在我们的 gradle 脚本中,我们使用 jdbc 运行一些带有 gradle 的 mysql 脚本。 我的问题:有没有类似的方法可以通过 gradle 为 mongo 执行脚本?
这是我们通过 gradle 执行 mysql 脚本的方式:
def props = [user: mySqlLoginName, password: mySqlPassword, allowMultiQueries: 'true'] as Properties
def driver = 'com.mysql.jdbc.Driver'
def sql = Sql.newInstance(mySqlUrl, props, driver)
File allModification = file("src/main/database/updateScript.sql")
String fileContents = allModification.text
println "\nUpdating mySql"
sql.execute fileContents
谢谢!
【问题讨论】:
-
为了让别人有机会回答这个问题,你必须详细描述你是如何运行 mysql 脚本的。