gradle dont use classpath dependencies in runtime
when add dependencies to buildscript they can be used inside of tasks at compile time, but not when I ran the tasks at runtime
buildscript {
repositories {
maven {
url "https://company.com/content/groups/public"
}
mavenLocal()
}
dependencies {
classpath 'net.sourceforge.jtds:jtds:1.2.4'
classpath 'org.codehaus.groovy:groovy-all:2.1.2'
}
}
import groovy.sql.Sql
task myTask << {
Sql sql = Sql.newInstance('someUrl', 'someuser', 'somepass', 'jdbc:jtds:sqlserver://localhost/db')
}
the task passes stage 1, but when executed doesn’t find driver class
so that some scenarios like: 1) task which connects to db - doesnt find driver class (dependency is in classpath) 2) task with custom logj4 and log4j.properties doesn’t see appenders, cause log4j.properties is not in classpath