Fix 'maven' plugin deprecation

This commit is contained in:
Lanchon 2019-11-17 07:27:51 -03:00
parent ece066992a
commit 1bac7a1632

View File

@ -10,8 +10,8 @@
plugins { plugins {
id 'java-library' id 'java-library'
id 'maven-publish'
id 'signing' id 'signing'
id 'maven'
} }
def dexlib2Version = '2.3.4' def dexlib2Version = '2.3.4'
@ -33,6 +33,11 @@ dependencies {
api 'org.smali:dexlib2:' + dexlib2Version api 'org.smali:dexlib2:' + dexlib2Version
} }
java {
withJavadocJar()
withSourcesJar()
}
def sharedManifest = manifest { def sharedManifest = manifest {
attributes( attributes(
'Implementation-Title': 'multidexlib2', 'Implementation-Title': 'multidexlib2',
@ -40,84 +45,64 @@ def sharedManifest = manifest {
) )
} }
jar { tasks.withType(Jar).configureEach {
manifest.from sharedManifest manifest.from sharedManifest
reproducibleFileOrder = true reproducibleFileOrder = true
preserveFileTimestamps = false preserveFileTimestamps = false
duplicatesStrategy = DuplicatesStrategy.FAIL duplicatesStrategy = DuplicatesStrategy.FAIL
} }
task sourcesJar(type: Jar) { publishing {
classifier = 'sources' publications {
from sourceSets.main.allSource multidexlib2(MavenPublication) {
manifest.from sharedManifest artifactId = 'multidexlib2'
reproducibleFileOrder = true from components.java
preserveFileTimestamps = false pom {
duplicatesStrategy = DuplicatesStrategy.FAIL name = 'multidexlib2'
} description = 'Multi-dex extensions for dexlib2.'
url = 'https://github.com/DexPatcher/multidexlib2'
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
manifest.from sharedManifest
reproducibleFileOrder = true
preserveFileTimestamps = false
duplicatesStrategy = DuplicatesStrategy.FAIL
}
artifacts {
archives sourcesJar
archives javadocJar
}
if (project.hasProperty('ossrhUsername')) {
signing {
sign configurations.archives
}
uploadArchives {
repositories.mavenDeployer {
pom.project {
name 'multidexlib2'
description 'Multi-dex extensions for dexlib2.'
url 'https://github.com/DexPatcher/multidexlib2'
scm { scm {
connection 'scm:git:git://github.com/DexPatcher/multidexlib2.git' connection = 'scm:git:git://github.com/DexPatcher/multidexlib2.git'
developerConnection 'scm:git:ssh://github.com:DexPatcher/multidexlib2.git' developerConnection = 'scm:git:ssh://github.com:DexPatcher/multidexlib2.git'
url 'https://github.com/DexPatcher/multidexlib2/tree/master' url = 'https://github.com/DexPatcher/multidexlib2/tree/master'
} }
licenses { licenses {
license { license {
name 'GNU General Public License (version 3 or later)' name = 'GNU General Public License (version 3 or later)'
url 'https://www.gnu.org/licenses/gpl.txt' url = 'https://www.gnu.org/licenses/gpl.txt'
} }
} }
developers { developers {
developer { developer {
name 'Lanchon' name = 'Lanchon'
url 'https://github.com/Lanchon' url = 'https://github.com/Lanchon'
} }
} }
} }
}
}
}
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { publishing {
authentication userName: ossrhUsername, password: ossrhPassword repositories {
maven {
if (project.hasProperty('publishing.url')) {
url = project.getProperty('publishing.url')
credentials {
username = project.getProperty('publishing.username')
password = project.getProperty('publishing.password')
} }
} else {
url = layout.buildDirectory.dir('repository')
}
}
}
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { signing {
authentication userName: ossrhUsername, password: ossrhPassword if (project.hasProperty('signing.secretKeyRingFile')) {
sign publishing.publications.multidexlib2
} }
beforeDeployment {
signing.signPom(it)
}
}
}
} }
wrapper { wrapper {