Created
August 27, 2013 11:32
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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