Создать changeLog из различий между базой данных и персистентными сущностями
Когда я запускаю этот скрипт, я получил исключение
Не удалось получить неизвестное свойство 'sourceSets' для задачи ':liquibaseDiffChangelog' типа org.gradle
enter code here
.api.tasks.JavaExec.
configurations {
liquibase
}
dependencies {
liquibase group: 'org.liquibase.ext', name: 'liquibase-hibernate4', version: 3.5
}
//loading properties file.
Properties liquibaseProps = new Properties()
liquibaseProps.load(new FileInputStream("src/main/resources/liquibase-task.properties"))
Properties applicationProps = new Properties()
applicationProps.load(new FileInputStream("src/main/resources/application.properties"))
task liquibaseDiffChangelog(type: JavaExec) {
group = "liquibase"
classpath = sourceSets.main.runtimeClasspath
classpath += configurations.liquibase
main = "com.crossover.techtrial.CrossBlogsApplication"
args "--changeLogFile=" + liquibaseProps.getProperty('liquibase.changelog.path')+ buildTimestamp() +"_changelog.xml"
args "--referenceUrl=hibernate:spring:" + liquibaseProps.getProperty('liquibase.domain.package') + "?dialect=" + applicationProps.getProperty('spring.jpa.properties.hibernate.dialect')
args "--username=" + applicationProps.getProperty('spring.datasource.username')
args "--password=" + applicationProps.getProperty('spring.datasource.password')
args "--url=" + applicationProps.getProperty('spring.datasource.url')
args "--driver=com.mysql.jdbc.Driver"
args "diffChangeLog"
}
def buildTimestamp() {
def date = new Date()
def formattedDate = date.format('yyyyMMddHHmmss')
return formattedDate
}