Reputation: 2551
I have a java ee project with a existing db-schema. Now I want to use liquibase for the db.
So I generated a changelog from my existing schema at the command line. Run that changelog against the existing database with mvn liquibase:changeLogSync
and now I can work with liquibase without problems.
My question is: can I use the changeLogSync
command within the project without executing it manuell? F.e. like I use new files with changesets:
<include file="changelogs/db.changelog1.xml"/>
Is there a similar way for changeLogSync
, like this one in Ant:
<changeLogSync
changeLogFile="${db.changelog.file}"
driver="${database.driver}"
url="${database.url}"
username="${database.username}"
password="${database.password}"
classpathref="classpath"
>
</changeLogSync>
Upvotes: 2
Views: 2525
Reputation: 6408
Sure. Here's ours:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>2.0.5</version>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>${ojdbc.version}</version>
</dependency>
</dependencies>
<configuration>
<changeLogFile>${db.changelog.file}</changeLogFile>
<driver>${database.driver}</driver>
<url>${database.url}</url>
<username>${database.username}</username>
<password>${database.password}</password>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>changeLogSync</goal>
</goals>
</execution>
</executions>
</plugin>
Adjust of course for your own DB flavor and build phase preferences.
Upvotes: 1