afterEvaluate { publishing { publications { aar(MavenPublication) { from components.release
groupId = projectGroupId artifactId = projectArtifactId version = projectVersionName
pom { name = projectArtifactId description = projectDescription // If your project has a dedicated site, use its URL here url = projectGitUrl if (projectLicense) { licenses { license { name = projectLicense url = projectLicenseUrl } } } developers { developer { id = developerAuthorId name = developerAuthorName email = developerAuthorEmail } } // Version control info, if you're using GitHub, follow the format as seen here scm { connection = "scm:git:${projectGitUrl}" developerConnection = "scm:git:${projectGitUrl}" url = projectGitUrl } withXml { xmlProvider -> def node = xmlProvider.asNode() def getAt = node.getAt('dependencies') def dependenciesNode if (getAt == null) { dependenciesNode = node.appendNode('dependencies') } else { dependenciesNode = getAt[0] } configurations.api.allDependencies.each { dependency -> if (!dependency.hasProperty('dependencyProject')) { def dependencyNode = dependenciesNode.appendNode('dependency') dependencyNode.appendNode('groupId', dependency.group) dependencyNode.appendNode('artifactId', dependency.name) dependencyNode.appendNode('version', dependency.version) } } } } } }
repositories { maven { name = projectArtifactId
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" // You only need this if you want to publish snapshots, otherwise just set the URL // to the release repo directly url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
// The username and password we've fetched earlier credentials { username mavenUsername password mavenPassword } } } } }
Be the first person to leave a comment!