I am trying to fetch all the version of single dependency from the artifactory through my gradle script.The issue is gradle only fetch the latest version of the dependency and that is causing an issue with my applcation.whereas I am able to do the same in maven.Why gradle is not fetching all the version of that dependency.Below is the example
dependencies {
runtime "carediscovery.services:GenericServices:1.0@jar"
runtime "carediscovery.services:GenericServices:1.1@jar"
runtime "carediscovery.services:GenericServices:1.2@jar"
runtime "carediscovery.services:GenericServices:1.3@jar"
runtime "carediscovery.services:GenericServices:1.5@jar"
runtime "carediscovery.services:GenericServices:1.6@jar"
runtime "carediscovery.services:LoadPathways:1.0@jar"
runtime "carediscovery.services:LoadPathways:1.1@jar"
}
Gradle script is fetching only 1.6 version for GenericServices.
Can someone tell me is there anyway to fetch all the dependencies from 1.0...1.6 in gradle?
I tried the below code but this is giving me the error can someone tell why it is giving me this
apply plugin: 'java'
repositories {
maven {
url "http://cm.t.thn.com:8/artifactory/services-release-local"
}
}
def deps = [GenericServices: (0..6), LoadPathways: (0..1)]
deps.each { dep, version ->
configurations.create("$dep$version")
dependencies.add("$dep$version", "carediscovery.services:$dep:1.$version@jar")
}
task copy(type: Copy) {
from(deps.collect { dep -> dep.value.collect { configurations."$dep.key$it" } }.flatten())
into 'services/carediscovery/services'
}
Below is the error results
**C:\NEW_HG_WORKSPACE\APPLICATION-DATA>gradle clean build
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\NEW_HG_WORKSPACE\APPLICATION-DATA\build.gradle' line: 20
* What went wrong:
A problem occurred evaluating root project 'application-data'.
> Could not find property 'GenericServices0' on configuration container.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED**
I fixed the above issue and it is working fine now
apply plugin: 'java'
repositories {
maven {
url "http://c.t.t.com:8/artifactory/services-release-local"
}
}
def deps = [GenericServices: (0..6), LoadPathways: (0..1)]
deps.each { dep, versions ->
versions.each { version ->
configurations.create("$dep$version")
dependencies.add("$dep$version", "carediscovery.services:$dep:1.$version@jar")
}
}
task copy(type: Copy) {
from(deps.collect { dep -> dep.value.collect { configurations."$dep.key$it" } }.flatten())
into 'services/carediscovery/services'
}