I’m trying to create a database in a custom task defined in buildSrc.
Although the driver seems on the classpath, when performing
Class.forName("org.h2.Driver"); I get a ‘No suitable driver found’.
When creating the Driver class manually via
Driver driver = new Driver(); it just creates the instance.
I’ve set up an example at https://github.com/marceloverdijk/test-jdbc-in-buildsrc just run
./gradlew clean createDatabase to reproduce the issue.