liquibase / liquibase-gradle-plugin

A Gradle plugin for Liquibase
Other
200 stars 59 forks source link

Can't find jdbc driver when useing new-plugin-mechanism #7

Closed zhangpp520 closed 8 years ago

zhangpp520 commented 8 years ago

When I use the format

plugins {
  id "org.liquibase.gradle" version "1.2.1"
}

in the build.gradle,I got an error:

Cannot find database driver: org.postgresql.Driver

So,I must add this line

buildscript {
  dependencies {
    classpath 'org.postgresql:postgresql:9.4.1207.jre7'
  }
}

before the plugins targets.Is there another way to set the JDBC driver classpath ?

stevesaliman commented 8 years ago

At the moment, there isn't another way to set it. The JDBC driver needs to be in the build script's classpath when it executes liquibase tasks, and buildscript block is a standard way of including external dependencies.

There might be some clever way of specifying the dependency in the liquibase closure and fixing the classpath at runtime, but to be honest, this is a pretty low priority since it would add complexity to the plugin, and a simple, standard way exists to get the classpath we need.