带有gradle的数据库(Liquibase)-无法转换POM.xml

时间:2018-11-20 12:49:27

标签: mysql maven gradle liquibase

我尝试将ia maven pom.xml转换为build.gradle。但是我不知道如何...

<plugin>
  <groupId>org.liquibase</groupId>
  <artifactId>liquibase-maven-plugin</artifactId>
  <version>3.0.5</version>
 <configuration>
  <changeLogFile>src/main/resources/bank_schema.xml</changeLogFile>
  <driver>com.mysql.jdbc.Driver</driver>
  <url>jdbc:mysql://localhost/bank</url>
  <username>teller</username>
  <password>password</password>
 </configuration>
 <executions>
  <execution>
   <phase>process-resources</phase>
  <goals>
   <goal>update</goal>
  </goals>
  </execution>
 </executions>
</plugin>

我的build.gradle代码到现在为止:

dependencies {
   [...]
    compile group: 'mysql', name: 'mysql-connector-java', version:'5.1.27'
    classpath('org.liquibase:liquibase-gradle-plugin:2.0.1') {
        exclude(module: 'liquibase-core')   // exclude the dependency on liquibase-core:3.3.5
    }
    classpath('org.liquibase:liquibase-core:3.4.0')
}
apply plugin: 'org.liquibase.gradle'

liquibase {
    activities {
        main {
            changeLogFile 'scr/main/resources/bank_schema.xml'
            url 'jdbc:mysql://localhost/bank'
            driver 'com.mysql.jdbc.Driver'
            username 'teller'
            password 'password'
        }
    }
    runList = 'main'
}

我不知道如何实现它,尤其是执行部分

我收到此错误:

Could not find method classpath() for arguments [org.liquibase:liquibase-gradle-plugin:2.0.1,  build_j5vwxauqx5o94sjkyaxcsyeo$_run_closure2$_closure7@1fd4c2e3] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

我希望有人可以帮助我:)

------更新:

现在我有

plugins {
    id 'java'
    id 'maven'
    id 'org.liquibase.gradle' version '2.0.1'
}

group 'cucumber_cash_withdrawal'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
      [...]
    liquibaseRuntime 'org.liquibase:liquibase-core:3.6.1'
    liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:2.0.1'
    liquibaseRuntime 'mysql:mysql-connector-java:5.1.34'
}

liquibase {
    activities {
        main {
            changeLogFile 'scr/main/resources/bank_schema.xml'
            url 'jdbc:mysql://localhost/bank'
            driver 'com.mysql.jdbc.Driver'
            username 'teller'
            password 'password'
        }
    }
    runList = 'main'
}

但这仍然行不通...我得到'org.gradle.api.NamedDomainObjectContiner'无法应用于'(java.lang.String)'

0 个答案:

没有答案