Thanks for the inputs. Changing group name/version didnt work. Basically what i need is i want to copy dependencies to a folder called lib.
We maintain two structures in SVN. One have source code and the other have some kind of bin, conf , lib etc. In this case, unforntunately, both have same folder name i.e, source code also has name abc
which generates jar abc-1.0.jar
uploads to artifactory. The other path also has same name abc
which just downloads the abc-1.0.jar
from artifactory and prepares lib.
I tried the approach you suggested and couple of other approaches found over internet:
FYI: This is my full build.gradle
.
ext {
libsDir='lib'
}
/** tried changin the group **/
group="com.temp"
/** tried setting below flags, didnt work **/
//jar.enabled=false
//build.enabled=false
dependencies {
//runtimeOnly "mygroup:xyz:1.0" // if i enable this, xyz jar getting downloaded and copied to lib
runtimeOnly "mygroup:abc:1.0" // but this is not coming
}
configurations.all {
resolutionStrategy {
force "mygroup:abc:1.0" //i even tried this, but didnt work :(
}
}
clean {
delete fileTree(dir:"$libsDir", include: '**.jar')
}
tasks.register('copyDeps',Copy) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from configurations.runtimeClasspath
into "lib" //this will be set by callers..
doLast {
println "dependencies copied"
}
}
build.finalizedBy(copyDeps)
Running gradle build generates below logs (fyi) :
Task :compileJava NO-SOURCE
Skipping task â:compileJavaâ as it has no source files and no previous output files.
:compileJava (Thread[included builds,5,main]) completed. Took 0.005 secs.
Resolve mutations for :processResources (Thread[Execution worker,5,main]) started.
Resolve mutations for :processResources (Thread[Execution worker,5,main]) completed. Took 0.0 secs.
:processResources (Thread[included builds,5,main]) started.
Task :processResources NO-SOURCE
Skipping task â:processResourcesâ as it has no source files and no previous output files.
:processResources (Thread[included builds,5,main]) completed. Took 0.001 secs.
Resolve mutations for :classes (Thread[Execution worker,5,main]) started.
Resolve mutations for :classes (Thread[Execution worker,5,main]) completed. Took 0.0 secs.
:classes (Thread[included builds,5,main]) started.
Task :classes UP-TO-DATE
Skipping task â:classesâ as it has no actions.
:classes (Thread[included builds,5,main]) completed. Took 0.0 secs.
Resolve mutations for :jar (Thread[Execution worker,5,main]) started.
Resolve mutations for :jar (Thread[Execution worker,5,main]) completed. Took 0.0 secs.
:jar (Thread[included builds,5,main]) started.
Task :jar SKIPPED
Skipping task â:jarâ as task onlyIf is false.
:jar (Thread[included builds,5,main]) completed. Took 0.0 secs.
Resolve mutations for :startScripts (Thread[Execution worker,5,main]) started.
Resolve mutations for :startScripts (Thread[Execution worker,5,main]) completed. Took 0.0 secs.
:startScripts (Thread[included builds,5,main]) started.
Task :test NO-SOURCE
Skipping task â:testâ as it has no source files and no previous output files.
:test (Thread[Execution worker,5,main]) completed. Took 0.0 secs.
Resolve mutations for :check (Thread[included builds,5,main]) started.
Resolve mutations for :check (Thread[included builds,5,main]) completed. Took 0.0 secs.
:check (Thread[Execution worker,5,main]) started.
Task :check UP-TO-DATE
Skipping task â:checkâ as it has no actions.
:check (Thread[Execution worker,5,main]) completed. Took 0.0 secs.
Resolve mutations for :build (Thread[included builds,5,main]) started.
Resolve mutations for :build (Thread[included builds,5,main]) completed. Took 0.0 secs.
:build (Thread[Execution worker Thread 7,5,main]) started.
Task :build SKIPPED
Skipping task â:buildâ as task onlyIf is false.
:build (Thread[Execution worker Thread 7,5,main]) completed. Took 0.0 secs.
Resolve mutations for :copyDeps (Thread[included builds,5,main]) started.
Resolve mutations for :copyDeps (Thread[included builds,5,main]) completed. Took 0.0 secs.
:copyDeps (Thread[Execution worker Thread 7,5,main]) started.
producer locations for task group 0 (Thread[included builds,5,main]) started.
producer locations for task group 0 (Thread[included builds,5,main]) completed. Took 0.0 secs.
Task :copyDeps NO-SOURCE
Skipping task â:copyDepsâ as it has no source files and no previous output files.
:copyDeps (Thread[Execution worker Thread 7,5,main]) completed. Took 0.001 secs.
Can you please suggest.