You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Postgresql configuration works fine with normal flyway configuration but fails with custom configurations as below:
I am running it using: sbt app/prod:flywayInfo
enablePlugins(FlywayPlugin)
lazy val CustomConfig = config("custom") describedAs "A custom config." extend Runtime
lazy val customSettings: Seq[Def.Setting[_]] = Seq(
flywayUser := "customUser",
flywayPassword := "customPassword",
flywayUrl := "jdbc:postgresql://host:port/db",
flywayLocations += "db/migration"
)
// flywayBaseSettings(CustomConfig) doesnt work and is replaced by flywayBaseSettings(Runtime)
lazy val app = (project in file("app")).
settings(inConfig(CustomConfig)(FlywayPlugin.flywayBaseSettings(Runtime) ++ customSettings): _*)
The custom configuration keeps failing for postgresql driver. Below is the stacktrace
org.flywaydb.core.api.FlywayException: Unable to instantiate JDBC driver: org.postgresql.Driver => Check whether the jar file is present
[error] at org.flywaydb.core.internal.util.jdbc.DriverDataSource.<init>(DriverDataSource.java:136)
[error] at org.flywaydb.core.Flyway.configure(Flyway.java:1435)
[error] at org.flywaydb.core.Flyway.configure(Flyway.java:1414)
[error] at io.github.davidmweber.FlywayPlugin$FlywayOps$.configureSysProps$extension(FlywayPlugin.scala:295)
[error] at io.github.davidmweber.FlywayPlugin$FlywayOps$.configure$extension0(FlywayPlugin.scala:239)
[error] at io.github.davidmweber.FlywayPlugin$Flyway$.apply(FlywayPlugin.scala:219)
[error] at io.github.davidmweber.FlywayPlugin$.$anonfun$flywayBaseSettings$48(FlywayPlugin.scala:181)
[error] at io.github.davidmweber.FlywayPlugin$.withContextClassLoader(FlywayPlugin.scala:210)
[error] at io.github.davidmweber.FlywayPlugin$.withPrepared(FlywayPlugin.scala:193)
[error] at io.github.davidmweber.FlywayPlugin$.$anonfun$flywayBaseSettings$47(FlywayPlugin.scala:180)
[error] at io.github.davidmweber.FlywayPlugin$.$anonfun$flywayBaseSettings$47$adapted(FlywayPlugin.scala:180)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:271)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] Caused by: org.flywaydb.core.api.FlywayException: Unable to instantiate class org.postgresql.Driver : org.postgresql.Driver
[error] at org.flywaydb.core.internal.util.ClassUtils.instantiate(ClassUtils.java:61)
[error] at org.flywaydb.core.internal.util.jdbc.DriverDataSource.<init>(DriverDataSource.java:132)
[error] at org.flywaydb.core.Flyway.configure(Flyway.java:1435)
[error] at org.flywaydb.core.Flyway.configure(Flyway.java:1414)
[error] at io.github.davidmweber.FlywayPlugin$FlywayOps$.configureSysProps$extension(FlywayPlugin.scala:295)
[error] at io.github.davidmweber.FlywayPlugin$FlywayOps$.configure$extension0(FlywayPlugin.scala:239)
[error] at io.github.davidmweber.FlywayPlugin$Flyway$.apply(FlywayPlugin.scala:219)
[error] at io.github.davidmweber.FlywayPlugin$.$anonfun$flywayBaseSettings$48(FlywayPlugin.scala:181)
[error] at io.github.davidmweber.FlywayPlugin$.withContextClassLoader(FlywayPlugin.scala:210)
[error] at io.github.davidmweber.FlywayPlugin$.withPrepared(FlywayPlugin.scala:193)
[error] at io.github.davidmweber.FlywayPlugin$.$anonfun$flywayBaseSettings$47(FlywayPlugin.scala:180)
[error] at io.github.davidmweber.FlywayPlugin$.$anonfun$flywayBaseSettings$47$adapted(FlywayPlugin.scala:180)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:271)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver
[error] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[error] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error] at java.lang.Class.forName0(Native Method)
[error] at java.lang.Class.forName(Class.java:348)
[error] at org.flywaydb.core.internal.util.ClassUtils.instantiate(ClassUtils.java:59)
[error] at org.flywaydb.core.internal.util.jdbc.DriverDataSource.<init>(DriverDataSource.java:132)
[error] at org.flywaydb.core.Flyway.configure(Flyway.java:1435)
[error] at org.flywaydb.core.Flyway.configure(Flyway.java:1414)
[error] at io.github.davidmweber.FlywayPlugin$FlywayOps$.configureSysProps$extension(FlywayPlugin.scala:295)
[error] at io.github.davidmweber.FlywayPlugin$FlywayOps$.configure$extension0(FlywayPlugin.scala:239)
[error] at io.github.davidmweber.FlywayPlugin$Flyway$.apply(FlywayPlugin.scala:219)
[error] at io.github.davidmweber.FlywayPlugin$.$anonfun$flywayBaseSettings$48(FlywayPlugin.scala:181)
[error] at io.github.davidmweber.FlywayPlugin$.withContextClassLoader(FlywayPlugin.scala:210)
[error] at io.github.davidmweber.FlywayPlugin$.withPrepared(FlywayPlugin.scala:193)
[error] at io.github.davidmweber.FlywayPlugin$.$anonfun$flywayBaseSettings$47(FlywayPlugin.scala:180)
[error] at io.github.davidmweber.FlywayPlugin$.$anonfun$flywayBaseSettings$47$adapted(FlywayPlugin.scala:180)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:271)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (app / Prod / flywayInfo) org.flywaydb.core.api.FlywayException: Unable to instantiate JDBC driver: org.postgresql.Driver => Check whether the jar file is present
I'm using custom settings w/ the Postgres driver. In my experience, you have to add the Postgres JDBC jar as a library dependency in your build.sbt, like so:
Postgresql configuration works fine with normal flyway configuration but fails with custom configurations as below:
I am running it using:
sbt app/prod:flywayInfo
The custom configuration keeps failing for postgresql driver. Below is the stacktrace
Might be related to flyway/flyway#1923
The text was updated successfully, but these errors were encountered: