Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with using the Liquibase block in build.gradle #122

Open
DavidNovo opened this issue Apr 25, 2023 · 1 comment
Open

Problem with using the Liquibase block in build.gradle #122

DavidNovo opened this issue Apr 25, 2023 · 1 comment

Comments

@DavidNovo
Copy link

Take a look at this fragment of build.gradle:

`
import org.liquibase.gradle.LiquibaseTask

buildscript {
ext {
. . . .
}
}

plugins {
id 'org.liquibase.gradle' version '2.2.0'
id 'org.springframework.boot' version "${springBootVersion}"
id 'io.spring.dependency-management' version "${springDependencyManagementVersion}"
id 'war'
id 'jacoco'
id 'idea'
id 'org.sonarqube' version "${sonarVersion}"
id 'com.adarshr.test-logger' version '2.1.1'
id 'application'
}

version = "$proj_version"

sourceSets {
test {
java {
srcDirs = ['src/test/java']
}
}
}

dependencies {

implementation project(':task-common')

// spring
implementation "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
implementation "org.springframework.boot:spring-boot-starter-aop:$springBootVersion"
implementation "org.springframework.boot:spring-boot-starter-data-jdbc:$springBootVersion"
implementation "org.springframework.boot:spring-boot-starter-jdbc:$springBootVersion"
implementation "org.springframework.boot:spring-boot-starter-security:$springBootVersion"
implementation "org.springframework.boot:spring-boot-starter-validation:$springBootVersion"
implementation "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
implementation "org.springframework.boot:spring-boot-starter-quartz:$springBootVersion"
implementation "org.springframework.boot:spring-boot-starter-activemq:$springBootVersion"
compileOnly "org.springframework.boot:spring-boot-configuration-processor:$springBootVersion"

// datadog
implementation 'com.datadoghq:dd-trace-api:0.90.0'

//logging
implementation 'net.logstash.logback:logstash-logback-encoder:7.2'

//jdbc drivers
runtimeOnly 'com.oracle.database.jdbc:ojdbc10:19.18.0.0'

//openapi
implementation 'org.springdoc:springdoc-openapi-ui:1.6.13'
implementation 'org.springdoc:springdoc-openapi-security:1.6.13'

//testing
testImplementation "org.springframework.boot:spring-boot-starter-test:$springBootVersion"

// for Liquidbase
implementation 'org.liquibase:liquibase-core:4.8.0'
liquibaseRuntime 'org.liquibase:liquibase-gradle-plugin:2.0.1'
liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:2.0.2'
liquibaseRuntime 'com.h2database:h2'
runtimeOnly 'com.h2database:h2'

}

liquibase {
activities {
main {
changelogFile 'src/main/resources/db/changelog/db.changelog-master.yaml'
url 'jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1'
username 'sa'
password ''
}
}
}
...}
IntelliJ is giving me warnings that the 'main' in 'build' cannot be applied to '(groovy.lang.Closure)' . I ca still run and build the project but I still get that warning from IntelliJ. When I try to add a task to the build.gradle file like this:tasks.register('updateDatabase', LiquibaseTask) {
group = 'liquibase'
description = 'Update the database with the latest changes.'
activities.main.action = 'update'
}`

I can run 'gradle clan build' but if I try to run ' gradle rollbackDatabase' I get this error:
`> Could not create task ':task-dispatcher-service:rollbackDatabase'.

Could not get unknown property 'activities' for task ':task-dispatcher-service:rollbackDatabase' of type org.liquibase.gradle.LiquibaseTask.
`
Any way to fix this?

@stevesaliman
Copy link
Collaborator

I get that warning too. I've never figured out why :-)

I haven't spent a lot of time on it because, as you said, it doesn't affect anything with the build, it is just an annoying squiggly line in the IDE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants