diff --git a/baksmali/build.gradle b/baksmali/build.gradle index 7b94d594..234ca843 100644 --- a/baksmali/build.gradle +++ b/baksmali/build.gradle @@ -71,12 +71,16 @@ task fatJar(type: Jar) { } tasks.getByPath('build').dependsOn(fatJar) -uploadArchives { - repositories.mavenDeployer { - pom.project { - description 'baksmali is a disassembler for dalvik bytecode' - scm { - url 'https://github.com/JesusFreke/smali/tree/master/baksmali' +publish { + publishing { + publications { + mavenJava(MavenPublication) { + pom { + description = 'baksmali is a disassembler for dalvik bytecode' + scm { + url = 'https://github.com/JesusFreke/smali/tree/master/baksmali' + } + } } } } diff --git a/build.gradle b/build.gradle index 850c4e10..16b798a4 100644 --- a/build.gradle +++ b/build.gradle @@ -107,72 +107,74 @@ subprojects { } if (project.name in maven_release_projects) { - apply plugin: 'maven' + apply plugin: 'maven-publish' apply plugin: 'signing' group = 'org.smali' - task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from 'build/docs/javadoc' - } - - task sourcesJar(type: Jar) { - classifier = 'sources' - from sourceSets.main.allJava - } - - artifacts { - archives javadocJar - archives sourcesJar - } - - signing { - required { gradle.taskGraph.hasTask('uploadArchives') } - sign configurations.archives - } - - uploadArchives { - repositories.mavenDeployer { - configuration = configurations.archives - - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - if (rootProject.hasProperty('sonatypeUsername') && rootProject.hasProperty('sonatypePassword')) { - repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') { - authentication(userName: sonatypeUsername, password: sonatypePassword) - } - } - - pom.artifactId = project.name - - pom.project { - name project.name - url 'http://smali.org' - packaging 'jar' - licenses { - license { - name 'The BSD 3-Clause License' - url 'http://opensource.org/licenses/BSD-3-Clause' - distribution 'repo' + publishing { + publications { + mavenJava(MavenPublication) { + artifactId = project.name + from components.java + versionMapping { + usage('java-api') { + fromResolutionOf('runtimeClasspath') + } + usage('java-runtime') { + fromResolutionResult() } } - scm { - connection 'scm:git:git://github.com/JesusFreke/smali.git' - developerConnection 'scm:git:git@github.com:JesusFreke/smali.git' + + pom { + name = project.name + url = 'http://smali.org' + + licenses { + license { + name = 'The BSD 3-Clause License' + url = 'http://opensource.org/licenses/BSD-3-Clause' + distribution = 'repo' + } + } + scm { + connection = 'scm:git:git://github.com/JesusFreke/smali.git' + developerConnection = 'scm:git:git@github.com:JesusFreke/smali.git' + } + developers { + developer { + id = 'jesusfreke' + name = 'Ben Gruver' + email = 'jesusfreke@jesusfreke.com' + } + } } - developers { - developer { - id 'jesusfreke' - name 'Ben Gruver' - email 'jesusfreke@jesusfreke.com' + } + } + if (rootProject.hasProperty('sonatypeUsername') && rootProject.hasProperty('sonatypePassword')) { + repositories { + maven { + url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' + credentials { + username sonatypeUsername + password sonatypePassword } } } } } - tasks.getByPath(':release').dependsOn(uploadArchives) + signing { + required { gradle.taskGraph.hasTask('publish') } + sign(publishing.publications["mavenJava"]) + } + + java { + withJavadocJar() + withSourcesJar() + } + + tasks.getByPath(':release').dependsOn(publish) } } diff --git a/dexlib2/build.gradle b/dexlib2/build.gradle index 29d7b226..9a46eb8b 100644 --- a/dexlib2/build.gradle +++ b/dexlib2/build.gradle @@ -93,12 +93,16 @@ task generateAccessorTestDex(type: JavaExec, dependsOn: compileAccessorTestJava) args sourceSets.accessorTest.output.classesDirs } -uploadArchives { - repositories.mavenDeployer { - pom.project { - description 'dexlib2 is a library for reading/modifying/writing Android dex files' - scm { - url 'https://github.com/JesusFreke/smali/tree/master/dexlib2' +publish { + publishing { + publications { + mavenJava(MavenPublication) { + pom { + description = 'dexlib2 is a library for reading/modifying/writing Android dex files' + scm { + url = 'https://github.com/JesusFreke/smali/tree/master/dexlib2' + } + } } } } diff --git a/smali/build.gradle b/smali/build.gradle index 84402ab2..a24a0483 100644 --- a/smali/build.gradle +++ b/smali/build.gradle @@ -119,12 +119,16 @@ jflex { generateDir = new File(generateDir, 'org/jf/smali') } -uploadArchives { - repositories.mavenDeployer { - pom.project { - description 'smali is an assembler for dalvik bytecode' - scm { - url 'https://github.com/JesusFreke/smali/tree/master/smali' +publish { + publishing { + publications { + mavenJava(MavenPublication) { + pom { + description = 'smali is an assembler for dalvik bytecode' + scm { + url = 'https://github.com/JesusFreke/smali/tree/master/smali' + } + } } } } diff --git a/util/build.gradle b/util/build.gradle index cd2d3f26..fa2eb61c 100644 --- a/util/build.gradle +++ b/util/build.gradle @@ -37,12 +37,16 @@ dependencies { testImplementation depends.junit } -uploadArchives { - repositories.mavenDeployer { - pom.project { - description 'This library contains random utilities used by smali/baksmali/dexlib2' - scm { - url 'https://github.com/JesusFreke/smali/tree/master/util' +publish { + publishing { + publications { + mavenJava(MavenPublication) { + pom { + description = 'This library contains random utilities used by smali/baksmali/dexlib2' + scm { + url = 'https://github.com/JesusFreke/smali/tree/master/util' + } + } } } }