#!/bin/bash
# gradle-resolve.sh
tmp_dir=$(mktemp -d)
cat << EOF > $tmp_dir/build.gradle
plugins {
id 'java'
}
repositories {
jcenter()
}
dependencies {
implementation "$2"
}
tasks.register("getClasspath") {
doLast {
println configurations.runtimeClasspath.join(':')
}
}
tasks.register("getJar") {
doLast {
println configurations.runtimeClasspath[0]
}
}
EOF
(cd $tmp_dir && gradle $1 --console=plain --quiet)