Guest User

Untitled

a guest
Dec 15th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. apply plugin: 'maven-publish'
  2.  
  3. android {
  4. defaultConfig {
  5. project.archivesBaseName = <insert project name>
  6. project.version = android.defaultConfig.versionName
  7. }
  8. }
  9.  
  10. publishing {
  11. publications {
  12. bar(MavenPublication) {
  13. groupId '<insert group id>'
  14. artifactId archivesBaseName
  15. version version
  16. artifact(sourceJar)
  17. artifact("$buildDir/outputs/aar/${archivesBaseName}-${version}.aar")
  18. pom.withXml {
  19. def dependenciesNode = asNode().appendNode('dependencies')
  20. //Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
  21. configurations.compile.allDependencies.each {
  22. if (it.group != null && (it.name != null || "unspecified" == (it.name)) && it.version != null) {
  23. def dependencyNode = dependenciesNode.appendNode('dependency')
  24. dependencyNode.appendNode('groupId', it.group)
  25. dependencyNode.appendNode('artifactId', it.name)
  26. dependencyNode.appendNode('version', it.version)
  27. }
  28. }
  29. }
  30. }
  31. }
  32. repositories {
  33. maven {
  34. def userHome = System.getProperty("user.home")
  35. url "${userHome}/.m2/repository"
  36. }
  37. }
  38. }
Add Comment
Please, Sign In to add comment