2012-09-26 69 views
0

我發現graqu liquibase插件,許多人推薦我gradle-liquibase-plugintlberglund。我使用gradle這個版本1.2 我創建的build.gradle旁邊結構:Liquibase for gradle插件

apply plugin: 'java' 
apply plugin: 'liquibase' 

repositories { 
    mavenCentral() 
} 

dependencies { 
    compile('org.hsqldb:hsqldb:2.2.8') 
    compile('org.hsqldb:sqltool:2.2.8') 
    compile('com.h2database:h2:1.3.167') 
    compile('org.liquibase:liquibase-core:2.0.1') 
    compile('com.augusttechgroup:groovy-liquibase-dsl:0.7.3') 
    compile('postgresql:postgresql:9.1-901.jdbc4') 
} 

buildscript { 
    dependencies { 
     classpath 'com.augusttechgroup:gradle-liquibase-plugin:0.6.1' 
    } 
} 

databases { 
    postgre { 
     url = "${postgreBaseUrl}" + "${postgreDB}" 
     username = "${postgreUserName}" 
     password = "${postgreUserPassword}" 
    } 
} 

changelogs { 
    main { 
     file = file('src/main/liquibase/mainChanges.groovy') 
    } 
} 

task dbInit << { 
    databases.postgre.url = "${postgreBaseUrl}" 
    databases.postgre.username = "${postgreRootUserName}" 
    databases.postgre.password = "${postgreRootUserPassword}" 
    changelogs.main.file = file('src/main/liquibase/tablespaceChanges.groovy') 
} 

當我試圖運行「gradle這個建」的任務,我收到的短信

FAILURE: Build failed with an exception. 

* What went wrong: 
Could not resolve all dependencies for configuration ':classpath'. 
> Could not find group:com.augusttechgroup, module:gradle-liquibase-plugin, vers 
ion:0.6.1. 
    Required by: 
     :demo:unspecified 

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

BUILD FAILED 

我從中央Maven倉庫的依賴 maven repository

如果我把依賴標記爲「編譯」,那麼好吧。

dependencies { 
    compile 'com.augusttechgroup:gradle-liquibase-plugin:0.6.1' 
} 

我檢查我的本地庫,發現有gradle這個-liquibase-插件-0.6.1.jar

我不明白有什麼不對勁。我想作爲原始文檔中描述的在github

https://github.com/tlberglund/gradle-liquibase-plugin/blob/master/plugin.gradle

,但得到了同樣的結果。也許有人使用這個插件?

我真的需要幫助,我的英語不好對不起)

+0

你設法讓這個插件的工作?儘管我能夠實現它,但我發現它有很多問題,希望得到反饋,看看我是否是唯一遇到奇怪問題的人。 –

回答

1

問題是不相關的Liquibase插件。您只需在buildscript {}部分聲明存儲庫。 buildscript {}與腳本的其餘部分完全分離。你幾乎可以把它想成一個單獨的文件。在github上源

+0

Thanx!我會試試看。我認爲這對我有幫助! – dmgcodevil

0

展望(見的build.gradle文件),它看起來像張貼在oss.sonatype.org的構建。嘗試使用添加「https://oss.sonatype.org/content/repositories/releases/」作爲Maven倉庫

所以,你的build.gradle可能看起來像這樣:

buildscript { 
    repositories { 
     maven { 
      url uri('https://oss.sonatype.org/content/repositories/releases/') 
     } 
     mavenCentral() 
    } 
    dependencies { 
     classpath group:'net.saliman', name: 'gradle-liquibase-plugin', version: '1.0.0' 
    } 
} 
apply plugin: 'liquibase'