Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Root project build file for Artifactory deployment
buildscript {
ext.kotlin_version = "1.4.10"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// First step is to add the build info extractor dependency
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.17.2"
}
}
allprojects {
// Second step is to apply the necessary plugins to all of the subprojects
apply plugin: "com.jfrog.artifactory"
apply plugin: "maven-publish"
repositories {
google()
jcenter()
}
}
// Tell Artifactory where it should publish all of the artifacts to
artifactory {
contextUrl = "https://your_artifactory_url"
publish {
repository {
repoKey = "your_artifactory_repo_key"
username = "your_artifactory_username"
password = "your_artifactory_apiKey"
maven = true
}
}
}
// Finally, create the required publications for your subprojects of choice, and let Artifactory
// know that you want to publish them
project("app") {
// Publish should happen after invoking assemble
artifactoryPublish.dependsOn("assemble")
publishing {
// Specify the publications
publications {
// We will be publishing an APK
apk(MavenPublication) {
artifactId = "artifactory_artifactId"
groupId = "artifactory_groupId"
version = "v1.0.0"
artifact("$buildDir/outputs/apk/release/${project.getName()}-release-unsigned.apk")
}
}
}
// Tell Artifactory which publications to publish
artifactoryPublish {
publications(publishing.publications.apk)
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment