Skip to content

Instantly share code, notes, and snippets.

@PrashamTrivedi
Created August 27, 2013 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PrashamTrivedi/6352420 to your computer and use it in GitHub Desktop.
Save PrashamTrivedi/6352420 to your computer and use it in GitHub Desktop.
Gradle code to publish an artifact in maven local and local file repository (So that it can be added to other maven project later)
apply plugin: 'maven-publish'
group = 'grpId'
version = '1.0.1-SNAPSHOT'
android.libraryVariants
publishing {
publications {
mavenTest(MavenPublication) {
artifact {
String libsPathString = file(buildDir).absolutePath + '/libs'
String libsPath = file(libsPathString)
FileTree tree = fileTree(dir: libsPath, include: '**/*.aar')
tree.singleFile
}
}
}
repositories {
maven {
String versionName = version
String path = 'releases';
if (versionName.contains("SNAPSHOT")) {
path = 'snapshots'
}
println(path)
String home = System.getenv('HOME')
url "file://" + home + "/libraries/artyfactory/" + path
mavenLocal()
}
}
}
publishToMavenLocal.dependsOn assembleDebug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment