I run liquibase both via Spring context and via the liquibase maven plugin.
When I ran via Spring context, I refer to the changelog files as:
- <include file="classpath:/db/changelog/db.changelog-1.0.xml"/>
If I want to run the same via plugin, I have to edit paths manually:
- <include file="src/main/resources/db/changelog/db.changelog-1.0.xml"/>
I'd like to offer 2 options.
1. Add a possibility to understand the "classpath" name in the path and allow classpath setting in the plugin itself. At the moment my plugin config looks like:
- <plugin>
- <groupId>org.liquibase</groupId>
- <artifactId>liquibase-maven-plugin</artifactId>
- <version>2.0.5</version>
- <configuration>
- <!--${env} is set in the app.properties file, in order to work correctly run-->
- <!--mvn initialize liquibase:updateSQL-->
- <propertyFile>src/main/resources/db/config/liquibase-gensql-data-access.properties</propertyFile>
- <changeLogFile>src/main/resources/db/changelog/db.changelog-master.xml</changeLogFile>
- <migrationSqlOutputFile>src/main/resources/db/gen/migrate.sql</migrationSqlOutputFile>
- <!--<logging>debug</logging>-->
- <logging>info</logging>
- <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
- <!--<verbose>false</verbose>-->
- <dropFirst>true</dropFirst>
- </configuration>
- </plugin>
Or, as an alternative opiton, add all maven src folders to the classpath. For example src/main/resources and src/main/java. And allow set changeLogFile, migrationSqlOutputFile and other similar options with "classpath" in the name like "classpath:/somepathtothefile"