Issue with liquibase and Maven: Cannot find database driver: org.postgresql.Driver

Hi there,

I am using the liquibase plugin and I keep getting the following error:

  1. [ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:2.0.3:update (default) on project dbmigration: Error setting up or running Liquibase: java.lang.RuntimeException: Cannot find database driver: org.postgresql.Driver -> [Help 1]
  2. org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.liquibase:liquibase-maven-plugin:2.0.3:update (default) on project dbmigration: Error setting up or running Liquibase: java.lang.RuntimeException: Cannot find database driver: org.postgresql.Driver



I am configuring the liquibase plugin as follows:


  1.                
  2.                        
  3.                                 org.apache.maven.plugins
  4.                                 maven-compiler-plugin
  5.                                 2.3.2
  6.                                
  7.                                         1.6
  8.                                         1.6
  9.                                
  10.                        
  11.                        
  12.                                 org.liquibase
  13.                                 liquibase-maven-plugin
  14.                                 2.0.3
  15.                                
  16.                                        
  17.                                                 process-resources
  18.                                                
  19.                                                         update
  20.                                                
  21.                                        
  22.                                
  23.                                
  24.                                        
  25.                                                 postgresql
  26.                                                 postgresql
  27.                                                 9.0-801.jdbc4
  28.                                        
  29.                                
  30.                                
  31.                                         db/changelog-master.xml
  32.                                         org.postgresql.Driver
  33.                                         myurl
  34.                                         user
  35.                                         pass
  36.                                         false
  37.                                         main
  38.                                
  39.                        
  40.                
  41.            


and the following dependency is part of my project:



  1.        
  2.                
  3.                         postgresql
  4.                         postgresql
  5.                         9.0-801.jdbc4
  6.                         jar
  7.                         compile
  8.                
  9.        



If I manually inspect the specified postgres jar, it does contain the class org.postgresql.Driver.

And if I run maven with debugging output turned on, it looks like the plugin’s classpath contains that jar:


  1. [DEBUG] Created new class realm plugin>org.liquibase:liquibase-maven-plugin:2.0.3
  2. [DEBUG] Importing foreign packages into class realm plugin>org.liquibase:liquibase-maven-plugin:2.0.3
  3. [DEBUG]   Imported:  < maven.api
  4. [DEBUG] Populating class realm plugin>org.liquibase:liquibase-maven-plugin:2.0.3
  5. [DEBUG]   Included: org.liquibase:liquibase-maven-plugin:jar:2.0.3
  6. [DEBUG]   Included: postgresql:postgresql:jar:9.0-801.jdbc4
  7. [DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:1.0.4
  8. [DEBUG]   Included: org.liquibase:liquibase-core:jar:2.0.3
  9. [DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:2.0
  10. [DEBUG]   Excluded: org.apache.maven:maven-project:jar:2.0
  11. [DEBUG]   Excluded: org.apache.maven:maven-profile:jar:2.0
  12. [DEBUG]   Excluded: org.apache.maven:maven-model:jar:2.0
  13. [DEBUG]   Excluded: org.apache.maven:maven-artifact-manager:jar:2.0
  14. [DEBUG]   Excluded: org.apache.maven:maven-repository-metadata:jar:2.0
  15. [DEBUG]   Excluded: org.apache.maven:maven-artifact:jar:2.0
  16. [DEBUG]   Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-8
  17. [DEBUG]   Excluded: junit:junit:jar:4.8.1
  18. [DEBUG]   Excluded: classworlds:classworlds:jar:1.1-alpha-2


Any help is very much appreciated!