Skip to content

Commit 77917d8

Browse files
committed
Maven Central publishing
1 parent dd0482c commit 77917d8

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

build.gradle

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,38 @@ test {
195195
maxHeapSize = "4g"
196196
}
197197

198+
task sourcesJar(type: Jar, dependsOn: classes) {
199+
classifier 'sources'
200+
from sourceSets.main.allSource
201+
}
202+
203+
task javadocJar(type: Jar) {
204+
classifier 'javadoc'
205+
from javadoc
206+
}
207+
198208
publishing {
199209
publications {
200210
mavenJava(MavenPublication) {
201211
from components.java
202212
artifactId = 'smoothie-map'
213+
artifact sourcesJar
214+
artifact javadocJar
203215
pom {
204216
name = 'SmoothieMap 2'
205217
inceptionYear = '2018'
218+
licenses {
219+
license {
220+
name = 'The Apache Software License, Version 2.0'
221+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
222+
distribution = 'repo'
223+
}
224+
}
225+
scm {
226+
url = 'https://github.com/TimeAndSpaceIO/SmoothieMap'
227+
connection = 'scm:git:git://github.com/TimeAndSpaceIO/SmoothieMap.git'
228+
developerConnection = 'scm:git:ssh://github.com/TimeAndSpaceIO/SmoothieMap.git'
229+
}
206230
developers {
207231
developer {
208232
id = 'leventov'
@@ -211,8 +235,34 @@ publishing {
211235
url = 'https://timeandspace.io'
212236
}
213237
}
238+
issueManagement {
239+
system = 'GitHub'
240+
url = 'https://github.com/TimeAndSpaceIO/SmoothieMap/issues'
241+
}
214242
}
215243
}
216244
}
245+
ext {
246+
if (!project.hasProperty('sonatypeUrl'))
247+
sonatypeUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
248+
if (!project.hasProperty('sonatypeUsername')) sonatypeUsername = ''
249+
if (!project.hasProperty('sonatypePassword')) sonatypePassword = ''
250+
}
251+
repositories {
252+
maven {
253+
url = sonatypeUrl
254+
credentials {
255+
username = sonatypeUsername
256+
password = sonatypePassword
257+
}
258+
}
259+
}
260+
261+
ext.isReleaseVersion = !version.endsWith('SNAPSHOT')
262+
263+
signing {
264+
required { isReleaseVersion && gradle.taskGraph.hasTask('publish') }
265+
sign publishing.publications.mavenJava
266+
}
217267
}
218268

0 commit comments

Comments
 (0)