2012-09-26 71 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'