Skip to content

Instantly share code, notes, and snippets.

@bind-disney
Created November 28, 2019 06:17
Show Gist options
  • Save bind-disney/b738cf83c65062990b1a25891c610bfe to your computer and use it in GitHub Desktop.
Save bind-disney/b738cf83c65062990b1a25891c610bfe to your computer and use it in GitHub Desktop.
Запуск Liquibase-задач из командной строки
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.springframework.boot") version "2.2.0.RELEASE"
id("io.spring.dependency-management") version "1.0.8.RELEASE"
id("org.liquibase.gradle") version "2.0.1"
kotlin("jvm") version "1.3.50"
kotlin("plugin.spring") version "1.3.50"
kotlin("plugin.jpa") version "1.3.50"
}
group = "example.com"
version = "0.1.0-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_1_8
val developmentOnly by configurations.creating
configurations {
runtimeClasspath {
extendsFrom(developmentOnly)
}
}
allprojects {
ext {
set("databaseUrl", System.getenv("SPRING_DATASOURCE_URL"))
set("databaseUsername", System.getenv("SPRING_DATASOURCE_USERNAME"))
set("databasePassword", System.getenv("SPRING_DATASOURCE_PASSWORD"))
}
}
repositories {
mavenCentral()
maven { url = uri("https://repo.spring.io/milestone") }
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.liquibase:liquibase-core")
implementation("io.springfox:springfox-swagger2:2.9.2")
developmentOnly("org.springframework.boot:spring-boot-devtools")
runtimeOnly("org.postgresql:postgresql")
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
}
testImplementation("org.springframework.security:spring-security-test")
liquibaseRuntime("org.liquibase:liquibase-core")
liquibaseRuntime("org.postgresql:postgresql")
liquibaseRuntime("ch.qos.logback:logback-core:1.2.3")
liquibaseRuntime("ch.qos.logback:logback-classic:1.2.3")
}
liquibase {
activities.register("main") {
val databaseUrl by project.extra.properties
val databaseUsername by project.extra.properties
val databasePassword by project.extra.properties
this.arguments = mapOf(
"logLevel" to "info",
"changeLogFile" to "src/main/resources/db/changelog/changelog-master.yml",
"url" to databaseUrl,
"username" to databaseUsername,
"password" to databasePassword,
"classpath" to rootDir
)
}
runList = "main"
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "1.8"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment