Open GoogleCodeExporter opened 8 years ago
Original comment by gtack...@googlemail.com
on 18 Oct 2009 at 8:44
Original comment by gtack...@googlemail.com
on 18 Oct 2009 at 8:44
Would be very useful for us as we're managing a distributed development team
for a
virtual world. Mismatches between databases in various environments causes
havok!
thanks
Original comment by ckrom...@gmail.com
on 10 May 2010 at 1:47
Worth noting that if you run dbdeploy from and anttask inside a maven pom, then
when dbdeploy crashes maven when it is done (meaning no further tasks are
performed). Does dbdeploy contain a System.exit?
Original comment by hlascel...@gmail.com
on 8 Jun 2010 at 1:26
@4 it certainly shouldn't contain a System.exit, and it doesn't cause ant to
exit when run directly. Something else interesting is going on.
Original comment by gtack...@googlemail.com
on 9 Jun 2010 at 8:21
You're right... I just svn'd the code and had a look. No exits, except in the
CLI which isn't used.
Here is the code snippet we use from the pom:
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>test</phase>
<configuration>
<tasks>
<ant antfile="build.xml" target="update-database">
<property name="db.env" value="H2" />
</ant>
<echo message="DB Rebuild complete" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
And from the ant script:
<target name="update-database">
<dbdeploy driver="${db.driver}" url="${db.url}"
delimiter="/"
delimitertype="row"
userid="${db.username}"
password="${db.password}"
dir="${run.scripts.folder}" >
</dbdeploy>
</target>
The dbdeploy does run, then stops dead after the last numbered script. No
errors.
Original comment by hlascel...@gmail.com
on 9 Jun 2010 at 10:46
Hi there,
I wanted to use dbdeploy with maven projects and as no plugin existed, I
decided to implement my own Maven plugin. I thought it might be useful for
other users, and could be a useful contribution to dbdeploy if the developers
approve, so I've attached the source code here. There are three goals/mojos in
the plugin:
1. create-changelog-table (creates the changelog table for relevant dbms)
2. generate-change-script (generates output.sql and undo.sql in the
'target/dbdeploy' directory)
3. apply-change-script (applies changes to the database)
There are no phase bindings to the build lifecycle; I didn't think that made
sense as the default behaviour for the plugin.
The default directory for sql scripts is 'src/main/sql', although it can be
overridden.
Example plugin config to include in your project's POM:
<plugin>
<groupId>com.dbdeploy.maven</groupId>
<artifactId>maven-dbdeploy-plugin</artifactId>
<dependencies>
<dependency>
<include dependency for your jdbc driver here>
</dependency>
</dependencies>
<configuration>
<driver></driver>
<url></url>
<userid></userid>
<password></password>
<dbms></dbms>
</configuration>
</plugin>
To build the plugin, just do:
mvn clean install
Thanks
Alex.
Original comment by abco...@gmail.com
on 13 Jun 2010 at 6:44
Attachments:
Would be great if this maven plugin, created by abcoyle, will become hosted in
Google Code. Preferably, together with DBDeploy. So that we can just point our
POM.xml to the plugin repository and avoid the installation procedures.
Original comment by yegor256
on 21 Jul 2010 at 1:33
Ditto... That would be great.
Original comment by hlascel...@gmail.com
on 26 Jul 2010 at 10:13
I'm happy to contribute the code, but have not heard anything from the
committers. What is the best way to contact them?
Thanks
Original comment by abco...@gmail.com
on 26 Jul 2010 at 10:23
Would be nice to place dbdeploy on maven repository so that it could be added
to classpath as most of other software without guessing what jars are needed
and how they depend on each other.
Original comment by jigou...@gmail.com
on 3 Jan 2011 at 1:57
That is a great plugin. I use it with oracle. thanks!!
Original comment by iamhero....@gmail.com
on 16 Feb 2011 at 6:45
Nice plugin!!! I was actually going to write my own until I found this. Thank
you
Original comment by fcart...@gmail.com
on 1 Mar 2011 at 9:09
Thanks for all the contributions!
I've just committed r148, which contains a maven plugin as implemented by Jim
Bogan. He'd committed his changes to github, which made it much easier for me
to merge. This is a starting point; I'm going to take a look through Alex's
plugin to see if we can bring in any features from that one. Please try it and
feedback your experiences here.
I'm also working on maven central inclusion, this is in progress and I'm
expecting that the next release of dbdeploy - 3.0M3 - will be hosted there.
Original comment by gtack...@googlemail.com
on 8 Mar 2011 at 5:24
Original comment by gtack...@googlemail.com
on 15 Mar 2011 at 4:23
Documentation is at UsingTheMavenPlugin, and now hosted on maven central:
http://repo1.maven.org/maven2/com/dbdeploy/maven-dbdeploy-plugin/3.0M3/
Original comment by gtack...@googlemail.com
on 16 Mar 2011 at 11:58
Hi there,
Great news that there is now an official Maven plugin, and I'm glad if my
efforts were helpful and of use.
I have had a quick look at the source/documentation and I have the following
comments regarding differences between what I had provided and the released
version:
1. The plugin I originally provided included a goal/mojo to create the
changelog table, 'create-changelog-table'; this does not appear to be in the
released version but it could be useful, so should it be included?
2. I thought the goal names I used for the plugin might be a bit clearer? e.g.
'generate-change-script' instead of 'db-scripts'
'apply-change-script' instead of 'update'
Is shorter better than longer?
3. It was a bit 'hacky' but in my mojos I reassigned std err to collect the
dbdeploy output, the benefit was that it can be logged using Maven's logger
(makes for tidy output). See ApplyChangeScriptDbDeployMojo. It may not be a
desirable way of acheiving the result, but the general idea could also be of
interest?
Thanks
Alex.
Original comment by abco...@gmail.com
on 21 Mar 2011 at 11:44
Thanks for the feedback Alex. (And thanks again for sharing your original
patch.)
re: 1 (create-changelog-table)
Yes it should be useful. Looking at the code it relies on a dbdeploy-dist maven
artifact - I chose not to publish dbdeploy-dist to maven central as it doesn't
quite seem the right thing to do. But we could just include the files in the
maven plugin too, which will be a bit of jiggling around of the project
stucture but perfectly possible. In fact, the ant and cli interfaces should
also support this, I've created issue 57 to track.
re: 2 (goal names)
'generate-change-script' instead of 'db-scripts'
'apply-change-script' instead of 'update'
Your names are better I think. I'll update.
re: 3 (stdin/stdout)
I was impressed by your code here :) Though in the end it was working around
my laziness at not sensibly logging feedback out to a replaceable logging
interface, so I think I should fix the underlying problem (issue 9) - I've
moved this to be a requirement for release 3.0.
Thanks,
g
Original comment by gtack...@googlemail.com
on 29 Mar 2011 at 8:47
Original comment by gtack...@googlemail.com
on 29 Mar 2011 at 8:51
Hi,
I noticed that the default value of the scriptdirectory parameter for this plugin, is ${project.src.directory}/main/sql. While ${project.src.directory} is understandable in documentation, Maven does not substitute this with the actual source directory; I'm using Maven 3.0.3 if that is of concern.
Can this value not be ${basedir}/src/main/sql instead?
Thanks.
Original comment by Vineet.R...@gmail.com
on 21 Jul 2011 at 1:35
Original issue reported on code.google.com by
gtack...@googlemail.com
on 18 Oct 2009 at 8:44