Hi there,
This is my first post, so, howdy fellow greenhorns! :-)
Now, what I am trying to achieve may seem a bit convoluted and if I am going about this the wrong way - please let me know, I am happy to change the approach.
I have a maven-built webapp (well, it's not quite there yet). I am trying to integrate a creation of a new DB instance into the build itself, but I don't want to bind it to any particular phase (as in, maven lifecycle phase), because it is only intended to be run when the developer wants to get rid of an existing DB and create a new one (not too often, hopefully), on their own local environment. So, it's a slightly different requirement to the very common one, when the new (possibly embedded) database is built and populated before unit/integration testing and then subsequently dropped.
The reason I am trying to do it with maven is to be as platform independend as possible. If I put the SQL into a bash script, some of my teammates (alas, most of them) won't benefit from it much.
Now, I do know there is an sql maven plugin, and I got it working easily, by simply binding it to one of the phases (initialize).
Ok, so the questions are:
- Am I doing it wrong? Are there any "best practices" that apply to this scenario? Am I missing something?
- How can I execute a maven "execution" outside of "phase" scope?
As you can see, I am a maven newbie (started yesterday!), so I may be talking nonsense. Feel free to point that out :-) It may be because I am used to an obvious ant-like flow control in building scripts, and the declarative/IoC style of maven is not quite clear to me yet.
Some resources on similar topics I found:
http://stackoverflow.com/questions/22222808/automatically-creation-of-test-databases-using-maven
http://stackoverflow.com/questions/3166538/how-to-execute-maven-plugin-execution-directly-from-command-line
Thanks.
Michal