mautrok
mautrok

Reputation: 961

run liquibase from springboot inside eclipse

I run a spring boot application inside eclipse:

@SpringBootApplication
public class StatBasketServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(StatBasketServerApplication.class, args);
    }
}

properties file:

spring.jpa.hibernate.ddl-auto=none

 spring.h2.console.enabled=true

spring.datasource.url= jdbc:postgresql://localhost:5432/
spring.datasource.username=postgres
spring.datasource.password=postgres

spring.jpa.hibernate.ddl-auto=create-drop

When the application starts, no liquibase change is done.

Do i need to do something inside the gradle build? If i look at the console I don't see anything about liquibase.

The changelog is inside

resouces/db/changelog.xml

Update

That's my build file

buildscript {
    ext {
        springBootVersion = '1.4.1.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'

jar {
    baseName = 'statBasketServer'
    version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
} 


dependencies {
    compile('org.springframework.boot:spring-boot-starter')
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-data-jpa")    
    compile("org.springframework.boot:spring-boot-starter-data-solr")
    compile("org.springframework.boot:spring-boot-starter-hateoas")
    compile("org.json:json:20141113")
    compile("org.postgresql:postgresql:9.4-1201-jdbc4")
    compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.6.1")
    compile("org.codehaus.woodstox:woodstox-core-asl:4.4.1")
    compile group: 'org.postgresql', name: 'postgresql', version: '9.4.1211.jre7'        
    testCompile("org.springframework.boot:spring-boot-starter-test") 
    testCompile("com.jayway.jsonpath:json-path-assert:0.8.1") 

}

Upvotes: 1

Views: 1220

Answers (1)

Liping Huang
Liping Huang

Reputation: 4476

  1. You need add org.liquibase:liquibase-core to your classpath
  2. By default it will read db/changelog/db.changelog-master.yaml as the default changelog, or you can config it via liquibase.change-log in application.properties, spring boot also support the xml, json liquibase scripts.

Here is an example provided by spring boot, you can refer to it, one point is this example is using maven as the build tool.

Upvotes: 2

Related Questions