Hi all
I have to download a previously published jar file from a private maven repository and upload/publish it to another private maven repository. I tried the following:
repositories {
maven {
url = 'https://maven.pkg.github.com/my-org/my-repo'
credentials {
username = 'my-user'
password = 'my-password'
}
}
}
configurations {
download { transitive = false }
}
dependencies {
download "${project.group}:${project.name}:${project.version}"
}
task downloadPackage(type:Copy) {
from configurations.download
into "${buildDir}/libs"
}
task upload(dependsOn: downloadPackage) {
doFirst {
myUploadMethod configurations.download.singleFile
}
}
However, the download does not work since the dependency resolution tries to find the jar file locally over the implicit project dependency, i.e.
./gradlew my-sub-project:dependencies --configuration download
> Task :my-sub-project:dependencies
------------------------------------------------------------
Project :my-sub-project
------------------------------------------------------------
download
\--- my-group:my-sub-project:1.0.0 -> project :my-sub-project (*)
(*) - dependencies omitted (listed previously)
I tried to substitute the project dependency with the following modification to avoid the dependency omitting, but without success
configurations {
download {
transitive = false
resolutionStrategy {
dependencySubstitution {
substitute project(':my-sub-project') with module("${project.group}:${project.name}:${project.version}")
}
}
}
Is there any way to download the jar file of the own sub-project from the remote maven repository?
Any input or feedback is highly appreciated. Many thanks and best regards