'issue running liquibase commands with gradle
I'm trying to configure a springboot gradle project with Intellij and run different liquibase gradle commands. I am able to run the application successfully as well as most other gradle commands that I've tried, but whenever I run any liquibase commands I get the error: Could not find or load main class C:\Program I've set the run configurations for the Main class, I've tried changing the gradle settings and changing my JDK, and I still can't seem to figure out why it's looking at the program files for the main class or even how to change it. If anyone has encountered this issue, I would greatly appreciate any help! Thank you!
Solution 1:[1]
To install Gradle and add it to your path, follow Gradle releases.
Note: To use Spring Boot and Maven, see Using Liquibase with Spring Boot and Maven Project.
To create the project, use Spring Initializer:
Under Project, select Gradle Project. Select Java as your Language. Under Spring Boot, select 2.3.4. For Packaging, select Jar. Use version 11 for Java. After selecting your options, the project window needs to look similar to the screenshot:
Click GENERATE to download your project template as a zip file. Extract it and open it in your IDE.
Note: Liquibase supports a variety of commands. For now, Spring Boot integrates the update, future-rollback-sql, drop-all, update-testing-rollback, and clear-checksums commands.
Spring Boot offers a subset of the Liquibase configuration options. In the table, the Spring Boot options are listed against the Liquibase options.
To start using Liquibase and Spring Boot with Gradle:
Open the existing Spring Boot application.properties file. To find the file, navigate to src/main/resources/application.properties.
Add the following properties to run Liquibase migrations. Update the values depending on your database requirements:
spring.datasource.url=jdbc:h2:~/liquibase;DB_CLOSE_ON_EXIT=FALSE spring.datasource.username=sa spring.datasource.password= spring.liquibase.change-log=classpath:db/changelog/db.changelog-master.xml
Create a changelog file:
src/main/resources/db/changelog/db.changelog-master.xml.
Liquibase also supports the .sql, .yaml, or .json changelog formats. For more information, see Introduction to Liquibase and[Getting Started with Liquibase][3]
.Add code snippet from Liquibase documentation to your changelog file, including changesets.
Run your migration with the following command:
./gradlew bootRun
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Raul Balestra |