Maven integration help

I’m having issues getting the mavin plugin working, and the documentation in the manual looks like it is from the 1.6 version of the plugin. Right now I’m getting the error “The driver has not been specified either as a parameter or in a properties file.”

My pom.xml configuration is as follows.

    org.liquibase     liquibase-plugin   1.9.4.0       update   process-resources     src/main/resources/liquibase.properties       update        

If someone could update the manual for maven integration that would be great. Or if someone could just tell me what I’m doing wrong.

Thanks

I am not enough of a maven user to know.  Does anyone else have a suggestion?

Nathan

After playing around with this more, I believe my question should be, “How do I setup the plugin using the eclipse maven plugin?” Basically I want to create a project just for liquibase so that there is one place to maintain the database schema. I want to be able to just right-click and say new maven project than add the plugin and other dependencies. Am I going about this the completely wrong way? I have used Maven before, but I’m still pretty new at it.

For starters,  I remember having some issues with 1.9.4.0 so I’m using 1.9.3.0.  I don’t off-hand remember the specifics but to answer your question about the driver issue, what does your properties file look like that you are pointing to in your snippet?  It sounds as though the properties file does not contain a driver property.

Mine looks like so:

username=${datasource.username}
password=${datasource.password}
url=${datasource.url}
driver=${datasource.driver}
changeLogFile=database/changelogs/master.xml

Hope this helps.

Craziness. I switched to 1.9.3 and it seems to be working fine.

Thanks!

boomerhawk,

[...] I want to be able to just right-click and say new maven project than add the plugin and other dependencies. [...]

You could also look at creating an maven archetype for that purpose. That way you can just create a new project with your liquibase archetype and it will populate a POM file for you with all the needed dependencies and POM layout that you require.

—Jaco

I’m facing the same problem with 2.0rc7 only in command line in idea runs fine.

This is the statement:
project propmpt> mvn liquibase:rollback -DpropFile=liquibase.properties  -Dliquibase.rollbackCount=1

Any ideas?

I reported some problem, maybe this workaround will help

http://forum.liquibase.org/#Topic/49382000000062001

I am having the same problem and the workaround did not seem to help.  I am using maven 3 and liquibase 2.0.1 .  


Using the pom.xml below, with my update.xml in the src/main/resources directory, I can run  “mvn process-resources” and it will successfully run the update and then it will also successfully run the rollback.     I don’t want it to run both the update and rollback and so I try to run the specific goal with this command “mvn liquibase:update” .    At this point I get the error “[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:2.0.1:update (default-cli) on project bidsync-liquibase: The driver has not been specified either as a parameter or in a properties file.”


For whatever reason if you try to run the specific goal then the liquibase plugin ignores all of the configuration parameters that have been set.


Anyone have any solutions to this problem?



pom.xml

----------------------

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns=“http://maven.apache.org/POM/4.0.0” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance


    4.0.0

    liquibase

    liquibase

    Database Upgrades

    http://maven.apache.org

    

        

            com.oracle

            ojdbc14

            10.2.0.4.0

        

      

            org.liquibase

            liquibase-core

            2.0.1

        

    


    

        

            

                src/main/resources

            

        

        

            

                org.liquibase

                liquibase-maven-plugin

                2.0.1

                

                    

                        liquibase

                        process-resources

                        

                            target/classes/update.xml

                            false

                            oracle.jdbc.OracleDriver


                            ${jdbc.url}

                            ${jdbc.username}

                            ${jdbc.password}

                            ${liquibase.contexts}

                            1

                        

                        

                            update

                            rollback

                        

                    

                

            

        

    




Turns out I was able to solve my own problem.   The problem is that the example given here http://www.liquibase.org/manual/maven is wrong.   The configuration in the example is specified in the executions tag and it should be specified directly under the plugin tag.   Also a phase is not needed but you can use it if you want your update to run automatically when you do a mvn compile or a mvn test.    So using this new pom.xml I can run “mvn process-resources” or a “mvn compile” and the update goal will run successfully.    Or I can run “mvn liquibase:update” and the update goal will run successfully.    Or I can run “mvn liquibase:rollback -DrollbackCount=5”  and my rollback goal will run and rollback the last 5 change sets.   


One other note – you can create your own liquibase.properties file,  but I find it much easier to add settings to your ~/.m2/settings.xml file and then directly reference those properties in your pom.xml like I did with my ${jdbc.url} references.



pom.xml

----------------------

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns=“http://maven.apache.org/POM/4.0.0” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance


    4.0.0

    liquibase

    liquibase

    Database Upgrades

    http://maven.apache.org


    

        

            com.oracle

            ojdbc14

            10.2.0.4.0

        

        

            org.liquibase

            liquibase-core

            2.0.1

        

    

    

        

            

                src/main/resources

            

        

        

            

                org.liquibase

                liquibase-maven-plugin

                2.0.1

                

                    target/classes/update.xml

                    false

                    oracle.jdbc.OracleDriver

                    update.xml


                    ${jdbc.url}

                    ${jdbc.username}

                    ${jdbc.password}

                    ${liquibase.contexts}

                    ${rollbackCount}

                

                

                    

                        update

                        process-resources

                        

                            update

                        

                    

                    

                        rollback

                        

                            rollback

                        

                    

                

            

        

    


Could someone that uses maven more update the maven documentation page as needed?

Nathan

Hey, this has bailed me out. I had the same problem. On shifting the configuration tag to grace directly below the plug tag, everything worked seamlessly.

Here is the snippet

  1.  
  2.      
  3.        
  4.           org.liquibase
  5.           liquibase-maven-plugin
  6.           2.0.1
  7.          
  8.          
  9.                 true
  10.                 src/main/resources/liquibase-mysql.properties
  11.              
  12.          
  13.            
  14.               process-resources
  15.              
  16.              
  17.                 update
  18.              
  19.            
  20.          
  21.        
  22.      
  23.    

Cheers,
Simon Peter Muwanga.

I will update the documentation page with the information from this topic.

Daan

Hi, the documentation is still not up to date and shows the tag configuration in wrong position.


Could you please have a look at this ?


Thx

I wish they would update the documentation, wasted several hours trying to find out the problem.

Hi,


How can I proceed if i have two different databases with different properties (url, driver,…), in this case i must specify configuration in execution.


Please any idea?

pfff… documentation needs to be working… is it tested ??? don’t think so !