Hi folks. Could anyone tell me if a Maven plugin is available now for Liquibase 2? My project is currently working with 1.9.5, and we’d like to go to 2.5.
If so, how could I get my hands on it?
Thanks!
Hi folks. Could anyone tell me if a Maven plugin is available now for Liquibase 2? My project is currently working with 1.9.5, and we’d like to go to 2.5.
If so, how could I get my hands on it?
Thanks!
here is an example for Mssql server
<liquibase.version>2.0-rc6-SNAPSHOT</liquibase.version>
<sql.version>1.3</sql.version>
<mssql.driver.groupId>net.sourceforge.jtds</mssql.driver.groupId>
<mssql.driver>net.sourceforge.jtds.jdbc.Driver</mssql.driver>
<mssql.driver.artifactId>jtds</mssql.driver.artifactId>
<mssql.driver.version>1.2.2</mssql.driver.version>
<mssql.username>sa</mssql.username>
<mssql.password></mssql.password>
<changelog.PATH>${project.build.outputDirectory}</changelog.PATH>
<changelog.file>${changelog.PATH}/changeset-${project.artifactId}.xml</changelog.file>
<changelog.context>current</changelog.context>
<mssql.server>localhost</mssql.server>
<mssql.url.port>1433</mssql.url.port>
Note that 1.9.5 has used a liqubase-plugin artifact.
Cheers, Oleg
Thanks, Oleg. I should have said I’m a Liquibase/Maven newbie. Could you tell me where I could get the 2.0-rc6-SNAPSHOT? I have the 2.0-rc5 jar (core), but I still do not have the associated plugin itself.
this is a current trunk version, have a look at http://liquibase.org/forum/index.php?topic=672.0 how build it from sources
If you do not want build it so, change in properties
I have forgot to say one note.
The liquibases files should be placed in the output target directory, usually target. This is required, because of Maven classloader features.
To this i’m using a maven facility of resources.
This is a full source of my mssql-updater pom
src/main/liquibase
src/main/liquibase
/*.xml
/.sql
**/.csv
org.liquibase
liquibase-maven-plugin
${liquibase.version}
${mssql.driver.groupId}
${mssql.driver.artifactId}
${mssql.driver.version}
${changelog.file}
jdbc:jtds:sqlserver://${mssql.server}:${mssql.url.port};DatabaseName=${mssql.url.databasename}
${mssql.driver}
${mssql.username}
${mssql.password}
${changelog.context}
false
generate-step
compile
updateSQL
update-step
process-test-resources
update
org.codehaus.mojo
sql-maven-plugin
LATEST
${mssql.driver.groupId}
${mssql.driver.artifactId}
${mssql.driver.version}
jdbc:jtds:sqlserver://${mssql.server}:${mssql.url.port};DatabaseName=${mssql.url.databasename}
${mssql.driver}
${mssql.username}
${mssql.password}
true
row
GO
true
apply-sql
install
execute
<liquibase.version>2.0-rc6-SNAPSHOT</liquibase.version>
<sql.version>1.3</sql.version>
<mssql.driver.groupId>net.sourceforge.jtds</mssql.driver.groupId>
<mssql.driver>net.sourceforge.jtds.jdbc.Driver</mssql.driver>
<mssql.driver.artifactId>jtds</mssql.driver.artifactId>
<mssql.driver.version>1.2.2</mssql.driver.version>
<mssql.username>sa</mssql.username>
<mssql.password></mssql.password>
<changelog.PATH>${project.build.outputDirectory}</changelog.PATH>
<changelog.file>${changelog.PATH}/changeset-${project.artifactId}.xml</changelog.file>
<changelog.context>current</changelog.context>
<mssql.server>localhost</mssql.server>
<mssql.url.port>1433</mssql.url.port>
checksum-correction
<changelog.context>checksum-correction</changelog.context>
<changelog.file>${changelog.PATH}/checksum-${project.artifactId}.xml</changelog.file>
development
org.liquibase
liquibase-maven-plugin
${liquibase.version}
development
org.codehaus.mojo
sql-maven-plugin
${sql.version}
${project.artifactId}-develompent.sql
production
org.liquibase
liquibase-maven-plugin
${liquibase.version}
production
false
always
warn
true
never
fail
codehausSnapshots
Codehaus Snapshots
https://oss.sonatype.org/content/repositories/snapshots
default
false
always
warn
true
never
fail
codehausSnapshots
Codehaus Snapshots
https://oss.sonatype.org/content/repositories/snapshots
default
How it does work? Maven have predefined stages - phases in maven terminology.
We are interested in resources-process, compile and package.
I’m saving all liquibase-related files to the src/main/liquibase directory, that in phase resources-process are copied into ${project.build.outputDirectory}. Note resources could be filtered or not.
At the compile phase we manage call the liquibase in the updateSQL mode. Output file with sql you could found in the target/liquibase/migrate.sql
Let me know if something is not clear.
Oleg
I was able to work through the instructions from your previous post (with some help from my lead). We have both core and plugin built here now, and we’re up and running. Thank you so much for your help.
–Brian