Skip to content

Commit

Permalink
New maven signer.
Browse files Browse the repository at this point in the history
  • Loading branch information
igr committed Jun 18, 2018
1 parent 2c842e1 commit f89f649
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 40 deletions.
45 changes: 5 additions & 40 deletions gradle/publish-maven.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,19 @@

signing {
required { isAdminRelease }
sign configurations.archives
sign publishing.publications
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
afterEvaluate {
artifact sourcesJar
artifact javadocJar
}

customizePom(pom, project)

artifact sourcesJar
artifact javadocJar

if (isAdminRelease) {
// sign the pom
pom.withXml {
def pomFile = file("${project.buildDir}/generated-pom.xml")
writeTo(pomFile)
def pomAscFile = signing.sign(pomFile).signatureFiles[0]
artifact(pomAscFile) {
classifier = null
extension = 'pom.asc'
}
pomFile.delete()
}

// sign the artifacts
project.tasks.signArchives.signatureFiles.each {
artifact(it) {
def matcher = it.file =~ /-(sources|javadoc|jre9)\.jar\.asc$/
if (matcher.find()) {
classifier = matcher.group(1)
} else {
classifier = null
}
extension = 'jar.asc'
}
}
}
}
}
repositories {
Expand All @@ -79,15 +53,6 @@ publishing {
}
}

model {
tasks.publishMavenJavaPublicationToMavenLocal {
dependsOn(project.tasks.signArchives)
}
tasks.publishMavenJavaPublicationToMavenRepository {
dependsOn(project.tasks.signArchives)
}
}

task install(dependsOn: publishToMavenLocal) {
group = 'Publishing'
description = 'Installs artifacts to local Maven repository'
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
enableFeaturePreview('STABLE_PUBLISHING')

include 'distribution'

include 'jodd-all'
Expand Down

0 comments on commit f89f649

Please sign in to comment.