Skip to content

Commit 2e5885a

Browse files
committed
Update maven-publish configuration
1 parent 3324cca commit 2e5885a

File tree

1 file changed

+64
-66
lines changed

1 file changed

+64
-66
lines changed

build.gradle

Lines changed: 64 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -138,86 +138,84 @@ license {
138138
publishing {
139139
publications {
140140
maven(MavenPublication) {
141-
from components.java
142-
}
143-
}
144-
}
145-
146-
processResources {
147-
outputs.upToDateWhen { false }
148-
expand project.properties
149-
}
141+
pom {
142+
packaging = 'jar'
143+
url = 'https://www.trellisldp.org'
144+
inceptionYear = '2017'
145+
name = 'LDP Utilities for Apache Camel'
146+
description = 'Utilities for asynchronous integrations with Apache Camel'
147+
148+
organization {
149+
name = project.vendor
150+
url = project.homepage
151+
}
150152

151-
signing {
152-
required { !version.endsWith("SNAPSHOT") && gradle.taskGraph.hasTask("uploadArchives") }
153-
sign configurations.archives
154-
}
153+
developers {
154+
developer {
155+
id = 'acoburn'
156+
name = 'Aaron Coburn'
157+
email = 'acoburn (at) apache (dot) org'
158+
}
159+
}
155160

156-
uploadArchives {
157-
repositories.mavenDeployer {
158-
def sonatypeUsername = project.hasProperty('ossrhUsername') ? ossrhUsername : System.getenv("SONATYPE_USERNAME") ?: ""
159-
def sonatypePassword = project.hasProperty('ossrhPassword') ? ossrhPassword : System.getenv("SONATYPE_PASSWORD") ?: ""
160-
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
161+
scm {
162+
connection = 'scm:git:git://github.com/trellis-ldp/camel-ldp.git'
163+
developerConnection = 'scm:git:[email protected]/trellis-ldp/camel-ldp.git'
164+
url = 'https://github.com/trellis-ldp/camel-ldp'
165+
tag = 'HEAD'
166+
}
161167

162-
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
163-
authentication(userName: sonatypeUsername, password: sonatypePassword)
164-
}
168+
licenses {
169+
license {
170+
name = 'Apache License, Version 2.0'
171+
url = 'http://www.apache.org/licenses/LICENSE-2.0'
172+
comments = 'Copyright (c) 2017-2018 Trellis LDP'
173+
}
174+
}
165175

166-
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
167-
authentication(userName: sonatypeUsername, password: sonatypePassword)
168-
}
176+
}
177+
pom.withXml {
178+
// eliminate test-scoped dependencies
179+
asNode().dependencies.removeAll { dep -> dep.scope == "test" }
180+
}
169181

170-
pom.project {
171-
packaging 'jar'
172-
url 'http://www.trellisldp.org'
173-
inceptionYear '2017'
174-
name 'LDP Utilities for Apache Camel'
175-
description 'Utilities for asynchronous integrations with Apache Camel'
182+
from components.java
176183

177-
organization {
178-
name project.vendor
179-
url project.homepage
184+
artifact(sourceJar) {
185+
classifier = 'sources'
180186
}
181187

182-
developers {
183-
developer {
184-
id 'acoburn'
185-
name 'Aaron Coburn'
186-
email 'acoburn @ (domain of organization url)'
187-
organization 'Amherst College'
188-
organizationUrl 'https://www.amherst.edu'
189-
roles {
190-
role 'developer'
191-
}
192-
timezone '-5'
193-
}
188+
artifact(javadocJar) {
189+
classifier = 'javadoc'
194190
}
195-
196-
scm {
197-
connection 'scm:git:git://github.com/trellis-ldp/camel-ldp.git'
198-
developerConnection 'scm:git:[email protected]/trellis-ldp/camel-ldp.git'
199-
url 'https://github.com/trellis-ldp/camel-ldp'
200-
tag 'HEAD'
191+
}
192+
}
193+
repositories {
194+
maven {
195+
def sonatypeUsername = project.hasProperty('ossrhUsername') ? ossrhUsername : System.getenv("SONATYPE_USERNAME") ?: ""
196+
def sonatypePassword = project.hasProperty('ossrhPassword') ? ossrhPassword : System.getenv("SONATYPE_PASSWORD") ?: ""
197+
if (version.endsWith("SNAPSHOT")) {
198+
url "https://oss.sonatype.org/content/repositories/snapshots/"
199+
} else {
200+
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
201201
}
202-
203-
licenses {
204-
license {
205-
name 'Apache License, Version 2.0'
206-
url 'http://www.apache.org/licenses/LICENSE-2.0'
207-
comments 'Copyright (c) 2017-2018 Trellis LDP'
208-
}
202+
credentials {
203+
username sonatypeUsername
204+
password sonatypePassword
209205
}
210206
}
211207
}
212208
}
213209

214-
gradle.taskGraph.whenReady( { graph ->
215-
tasks.withType(AbstractArchiveTask).each { archive ->
216-
archive.doLast {
217-
ant.checksum file: archive.archivePath, algorithm: 'sha-256', format: 'MD5SUM', fileext: '.sha256'
218-
}
219-
}
220-
})
210+
processResources {
211+
outputs.upToDateWhen { false }
212+
expand project.properties
213+
}
214+
215+
signing {
216+
required { !version.endsWith("SNAPSHOT") && gradle.taskGraph.hasTask("uploadArchives") }
217+
sign publishing.publications
218+
}
221219

222220
checkstyle {
223221
configFile = rootProject.file('buildtools/src/main/resources/checkstyle/checkstyle.xml')
@@ -271,6 +269,6 @@ task getVersion {
271269
}
272270
}
273271

274-
afterReleaseBuild.dependsOn uploadArchives
272+
afterReleaseBuild.dependsOn publish
275273
afterReleaseBuild.dependsOn docs
276274

0 commit comments

Comments
 (0)