Skip to content

Instantly share code, notes, and snippets.

@chenzhang2006
Last active May 4, 2020 14:30
Show Gist options
  • Save chenzhang2006/b906a519906ff88b5e32b94ec844e839 to your computer and use it in GitHub Desktop.
Save chenzhang2006/b906a519906ff88b5e32b94ec844e839 to your computer and use it in GitHub Desktop.
publish 1
apply plugin: 'maven-publish'
def LIB_GROUP_ID = 'com.chenzhang2006.libraries'
def LIB_ARTIFACT_ID = 'droidlib'
def LIB_VERSION = '2.0.1'
task sourceJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier "sources"
}
publishing {
repositories {
maven {
name = "GithubPackages"
url = uri("https://maven.pkg.github.com/chenzhang2006/AndroidLibForArtifactory")
credentials {
username = System.getenv('GITHUB_USER') ?: project.properties['GITHUB_USER']
password = System.getenv('GITHUB_PERSONAL_ACCESS_TOKEN') ?: project.properties['GITHUB_PERSONAL_ACCESS_TOKEN']
}
}
maven {
name = 'CustomMavenRepo'
url = "file://${buildDir}/repo"
}
}
publications {
droidlib(MavenPublication) {
groupId LIB_GROUP_ID
artifactId LIB_ARTIFACT_ID
version LIB_VERSION
artifact("$buildDir/outputs/aar/droidlibrary-release.aar")
artifact(sourceJar)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment