Artifactory have two pre-defined repositories for local libraries:
libs-release-local: local repository for in-house librarieslibs-snapshot-local: local repository for in-house snapshotsThe Artifactory's Gradle script generator can generate a script which uses only one repository for artifact publishing, using the artifactory plugin for Gradle.
Here is an example (only the relevant portion):
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = 'libs-release-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
resolve {
repository {
repoKey = 'libs-release'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
I would like to configure the plugin to use the libs-release-local or libs-snapshot-local repository based on version (i.e. if version ends with -SNAPSHOT then publish to libs-snapshot-local).
I saw this is possible using Gradle's integrated maven plugin (see snapshotRepository element of mavenDeployer in uploadArchives task), but this functionality seems not available in the artifactory plugin.
Is there any way to achieve this desired behaviour?
Go to the artifact browser, select the repository you want to upload to, and hit the Set Me Up button for instructions. You can upload a file using Artifactory UI. Go to the artifact browser, select the repository you want to upload to, and hit the Upload button for instructions.
JFrog publishes a fully functional example of publishing aar to Artifactory. Here you go. Select the version of plugin you work with and look for aar example. We'll take a look and report.
Since it's a groovy code just go ahead and use a variable, which depends on the version.
String repo = version.endsWith('SNAPSHOT') ? 'libs-snapshot-local' : 'libs-release-local'
...
repository {
repoKey = repo
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With