Properties file error

I’m using Maven to run Liquibase and I get this error:

‘classpath’ in properties file is not being used by this task

I’m using a properties file as follows for an update goal:

changeLogFile=/somedir/changelog.xml
username=scott
password=password
url=jdbc:oracle:thin:@//localhost:1521/mydb
driver=oracle.jdbc.OracleDriver
classpath=…/…/ojdbc14-10.2.0.1.0.jar

Here’s the POM file plugin info:

       
          org.liquibase
          liquibase-plugin
          1.6.1.0
         
           
              process-resources
             
                  true
                resources/liquibase.properties
                  true
             
             
                update
             
           
         
       

Here’s the console output:

INFO] Parsing Liquibase Properties File
[INFO]  File: /Users/swillcox/projects/alm/alm-tool-oracle/target/liquibase.properties
[INFO]  ‘classpath’ in properties file is not being used by this task.
[INFO] ------------------------------------------------------------------------
[INFO] Settings----------------------------
[INFO]    driver: oracle.jdbc.OracleDriver
[INFO]    url: jdbc:oracle:thin:@//localhost:1521/mydb
[INFO]    username: scott
[INFO]    password: password
[INFO]    use empty password: false
[INFO]    properties file: /Users/swillcox/projects/alm/alm-tool-oracle/target/liquibase.properties
[INFO]    properties file will override? true
[INFO]    prompt on non-local database? true
[INFO]    clear checksums? false
[INFO]    changeLogFile: /somedir/changelog.xml
[INFO]    drop first? false
[INFO]    context(s): null
[INFO]    number of changes to apply: 0
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error setting up or running Liquibase: java.lang.RuntimeException: Cannot find database driver: oracle.jdbc.OracleDriver

As you can see it is ignoring the classpath property and as a result can not find the driver.

Any idea why it is ignoring the classpath property?

Reply on mailing list by swillcox:

Well after several hours I figured it out. The Liquibase doc for using Maven
needs to include this:

  • Add a dependency for the driver

 
     
          org.oracle
          ojdbc14
     
 

swillcox,

Your problem might be two sided:

  • You forgot to include the relevant JDBC driver for your database (as Nathan pointed out).
  • You used the drivername ``oracle.jdbc.OracleDriver'' (which is wrong)

I updated the documentation with the correct information: http://liquibase.org/manual/maven.

You will see that there is a section that instructs you to include the relevant database JDBC driver as well as the driver name was corrected from oracle.jdbc.OracleDriver'' to oracle.jdbc.driver.OracleDriver’’.

This is the correct dependency to use in your POM for the above driver name:

        com.oracle     ojdbc14     10.2.0.4

Hope that helps. :slight_smile:
—Jaco