# Maven Liquibase update command executes changeSet again even after getting executed on start-up

**URL:** <https://forum.liquibase.org/t/maven-liquibase-update-command-executes-changeset-again-even-after-getting-executed-on-start-up/5978>\
**Category:** General Discussion\
**Created:** [September 30, 2021, 11:17am UTC](https://forum.liquibase.org/t/maven-liquibase-update-command-executes-changeset-again-even-after-getting-executed-on-start-up/5978 "2021-09-30T11:17:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krathi](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@Krathi](https://forum.liquibase.org/u/Krathi)\
**Post date:** [September 30, 2021, 11:17am UTC](https://forum.liquibase.org/t/maven-liquibase-update-command-executes-changeset-again-even-after-getting-executed-on-start-up/5978/1 "2021-09-30T11:17:08Z")

</div>

Hi,

Liquibase runs on start-up in springboot application and executes all the new changeSets.  
When i run mvn liquibase:update without any changes in changeLog file, it runs all the changesets again and throws liquibase.exception.DatabaseException since the table already exists.  
The changeSet does not get executed when i re-run the application.

When i update changeSet using maven command before running the application, it works as expected. But if i run application after executing mvn liquibase:update command it runs the changesSet again and throws error

mvn liquibase:history command shows all the executed changeSets which got executed on start-up.

mvn liquibase:rollbackSQL --Dliquibase.rollbackCount=1 does not generate the expected rollback sql file.  
mvn liquibase:rollback --Dliquibase.rollbackCount=1 command does not behave as expected

Has anyone encountered this? Do you have a suggestion on how to solve this?

Thanks.

---

<div class="post-metadata">

**Author:** ![devdave](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/devdave/32/342_2.png) [@devdave](https://forum.liquibase.org/u/devdave)\
**Post date:** [September 30, 2021, 1:00pm UTC](https://forum.liquibase.org/t/maven-liquibase-update-command-executes-changeset-again-even-after-getting-executed-on-start-up/5978/2 "2021-09-30T13:00:25Z")

</div>

Hi @Krathi, that does seem like odd behaviour. The only thing I can think of is that there might be something different between the properties that are being used for running liquibase at application startup and for running the maven command.

Could you provide information about which version of Liquibase you’re using, which version of the liquibase-maven-plugin you’re using, the properties you’re using for application startup and for the maven command (are they both using the same liquibase.properties file?) and the database and version that you’re using?

Just out of interest, is there any reason why you need to be running liquibase on application startup and separately from a maven command? On the project that I work on we don’t have Liquibase running on application startup, we always manage running Liquibase separately either by devs running the maven command or if its a qa/staging/prod environment then Liquibase is run separately as part of the CI/CD pipeline. There’s no reason why you shouldn’t be able to run both as they should both work as expected, but maybe not running Liquibase at application startup is something to consider if this issue continues.

If you do want to try preventing Liquibase from running on application startup then depending on the version of Spring you’re using you can set a property in your application.properties file (or application.yaml if that’s what you’re using instead).

For the latest version of Spring you would set this:

`spring.liquibase.enabled=false`

For older versions of Spring you may need to use this instead:

`liquibase.enabled=false`

Hope that helps  
Dave

---

<div class="post-metadata">

**Author:** ![Krathi](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@Krathi](https://forum.liquibase.org/u/Krathi)\
**Post date:** [September 30, 2021, 3:23pm UTC](https://forum.liquibase.org/t/maven-liquibase-update-command-executes-changeset-again-even-after-getting-executed-on-start-up/5978/3 "2021-09-30T15:23:56Z")

</div>

Hi Dave,

Thank you for your response.

below are the details that you have asked,  
liquibase - 4.4.3  
liquibase maven plugin - 4.43  
database - postgres  
PostgreSQL -13.2

yes, both the files have same configuration.

**application.properties**  
spring.datasource.url=jdbc:postgresql://localhost:5432/testdb  
spring.datasource.username=test  
spring.datasource.password=test123  
spring.jpa.hibernate.ddl-auto=update  
spring.liquibase.change-log=classpath:/db/changelog/db.changelog-master.xml  
logging.level.liquibase=DEBUG

**liquibase.properties**  
url=jdbc:postgresql://localhost:5432/testdb  
username=test  
password=test123  
driver=org.postgresql.Driver  
changeLogFile=src/main/resources/db/changelog/db.changelog-master.xml

I want to run liquibase on startup so that i don’t have to do an additional step to update database. I wanted to use maven plugin for rollback purpose.

---

<div class="post-metadata">

**Author:** ![devdave](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/devdave/32/342_2.png) [@devdave](https://forum.liquibase.org/u/devdave)\
**Post date:** [September 30, 2021, 10:30pm UTC](https://forum.liquibase.org/t/maven-liquibase-update-command-executes-changeset-again-even-after-getting-executed-on-start-up/5978/4 "2021-09-30T22:30:23Z")

</div>

Hi Krathi,

I’ve just created a small spring boot test application with the same settings in the application.properties and liquibase.properties as you had and with the same liquibase version but with a slightly different postgres version (I just used latest version in a docker image) and I created a couple of simple changesets to create some tables but unfortunately I couldn’t replicate your issue 😕

It could be the postgres version that makes the difference but I can’t see why that would be the case. I’m also running on Windows and you may be running on a different OS so that also might be why I can’t replicate.

I can’t really think of any other cause of this issue so I’m a bit stumped with this one. Unless someone else on the forum can help the only other thing I can suggest is to post on the Liquibase discord to see if anyone there can help: [Discord](https://discord.com/channels/700506481111597066/)

Sorry I couldn’t be of more help with this, but I hope you manage to get to the bottom of it.  
Dave

---

<div class="post-metadata">

**Author:** ![Krathi](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@Krathi](https://forum.liquibase.org/u/Krathi)\
**Post date:** [October 1, 2021, 6:44am UTC](https://forum.liquibase.org/t/maven-liquibase-update-command-executes-changeset-again-even-after-getting-executed-on-start-up/5978/5 "2021-10-01T06:44:12Z")

</div>

Hi Dave,

Thank you very much for your help.  
I was able to find the issue. I had mentioned master file path differently in both the file i.e. application.properties and liquibase.properties because which the filename column in databasechangelog table was getting stored differently for both scenarios.

i.e db/changelog/db.changelog-master.xml when run on start-up and  
src/main/resources/db/changelog/db.changelog-master.xml when run using maven.
