Asim Khatri
05/30/2024, 12:18 PMapply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'
group = PUBLISH_GROUP_ID
version = PUBLISH_VERSION
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
groupId PUBLISH_GROUP_ID
artifactId PUBLISH_ARTIFACT_ID
version PUBLISH_VERSION
if (project.plugins.findPlugin("com.android.library")) {
from components.release
}
pom {
name = PUBLISH_ARTIFACT_ID
description = PUBLISH_ARTIFACT_DESC
url = "<https://www.developer.com>"
licenses {
license {
name = "The Apache Software License, Version 2.0"
url = "<http://www.apache.org/licenses/LICENSE-2.0.txt>"
}
}
developers {
developer {
id = "dev"
name = "Developer"
email = "dev@developer.com"
}
}
}
}
}
}
}
// Load properties from local.properties or environment variables
Properties artifactoryProperties = new Properties()
def afUser
def afPass
if (project.rootProject.file('local.properties').exists()) {
artifactoryProperties.load(project.rootProject.file('local.properties').newDataInputStream())
afUser = artifactoryProperties.get('af.user')
afPass = artifactoryProperties.get('af.pass')
} else {
afUser = System.getenv('AF_USER')
afPass = System.getenv('AF_PASS')
}
artifactory {
publish {
//The base Artifactory URL if not overridden by the publisher/resolver
contextUrl = '<https://my/artifactory>'
repository {
repoKey = 'android-repo'
username = afUser
password = afPass
}
defaults {
//If you'd like to deploy the artifacts from all the publications defined in the Gradle script, you can set the 'ALL_PUBLICATIONS' string, instead of the publication names.
publications ('ALL_PUBLICATIONS')
}
}
}
Please suggestVampire
05/30/2024, 1:34 PM