1apply plugin: 'maven-publish'
2apply plugin: 'com.jfrog.artifactory'
3
4publishing {
5    publications {
6        mavenJava(MavenPublication) {
7            groupId ddGroup
8            artifactId ddArtifactId
9            version ddVersion
10            artifact "${project.buildDir}/outputs/aar/${project.name}-release.aar"
11            artifact sourcesJar
12            artifact javadocJar
13
14            pom.withXml { xmlProvider ->
15                // Create string from project.ext.pomXml
16                def pomString = new StringWriter()
17                pomXml.writeTo(pomString)
18                pomString = pomString.toString()
19
20                // Replace default xml with pomXml
21                def xmlStringBuilder = xmlProvider.asString()
22                xmlStringBuilder.setLength(0)
23                xmlStringBuilder.append(pomString)
24            }
25        }
26    }
27}
28
29artifactory {
30    contextUrl = 'http://oss.jfrog.org/artifactory'
31    publish {
32        repository {
33            repoKey = 'oss-snapshot-local'
34            username = bintrayUser
35            password = bintrayKey
36            maven = true
37        }
38        defaults {
39            publications('mavenJava')
40        }
41    }
42}
43