I am assuming that by 'compiled test classes' in 2, you actually mean the main classes
If so, you should be able to do 1 & 2 like this
sourceSets {
test {
runtimeClasspath = output + configurations.testRuntime
}
}
dependencies {
testRuntime files(jar.archivePath) {
builtBy jar
}
}