Skip to content

Commit 7006f73

Browse files
committed
Finally a working bintray/mavenSync build.gradle.kts
1 parent 1900656 commit 7006f73

File tree

1 file changed

+53
-37
lines changed

1 file changed

+53
-37
lines changed

build.gradle.kts

Lines changed: 53 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
java
66
maven
77
`maven-publish`
8-
id("com.jfrog.bintray") version "1.8.0"
8+
id("com.jfrog.bintray") version "1.8.1"
99
}
1010

1111
val artifactId = "gistcafe"
@@ -15,6 +15,10 @@ val orgName = "ServiceStack"
1515
val shortDesc = "gist.cafe utils for Kotlin"
1616
val artifactVersion = version.toString()
1717

18+
val bintrayUpload: com.jfrog.bintray.gradle.tasks.BintrayUploadTask by tasks
19+
val clean: Task by tasks
20+
val build: Task by tasks
21+
1822
repositories {
1923
jcenter()
2024
}
@@ -24,47 +28,16 @@ tasks {
2428
archiveClassifier.set("sources")
2529
from(sourceSets["main"].allSource)
2630
}
31+
create<Jar>("javadocJar") {
32+
dependsOn.add(javadoc)
33+
archiveClassifier.set("javadoc")
34+
from(javadoc)
35+
}
2736
withType<Jar> {
2837
archiveBaseName.set(artifactId)
2938
}
3039
}
3140

32-
task("generatePom") {
33-
doLast {
34-
println("Generating the Maven POM file.")
35-
maven.pom {
36-
project {
37-
withGroovyBuilder {
38-
"name"(artifactId)
39-
"description"(shortDesc)
40-
"url"("https://github.com/$repoName")
41-
"licenses" {
42-
"license" {
43-
"name"("The 3-Clause BSD License")
44-
"url"("https://opensource.org/licenses/BSD-3-Clause")
45-
"distribution"("repo")
46-
}
47-
}
48-
"developers" {
49-
"developer" {
50-
"id"(orgName)
51-
"name"("$orgName, Inc.")
52-
"email"("[email protected]")
53-
}
54-
}
55-
"scm" {
56-
"connection"("scm:git:git://github.com/$repoName.git")
57-
"developerConnection"("scm:git:ssh://github.com/$repoName.git")
58-
"url"(repoUrl)
59-
}
60-
}
61-
}
62-
}
63-
.writeTo("META-INF/maven/${project.group}/${project.name}")
64-
.writeTo("$buildDir/pom.xml")
65-
}
66-
}
67-
6841
publishing {
6942
publications {
7043
create<MavenPublication>("mavenJava") {
@@ -111,6 +84,48 @@ publishing {
11184
}
11285
}
11386

87+
bintrayUpload.apply {
88+
dependsOn(clean)
89+
dependsOn(build)
90+
build.mustRunAfter(clean)
91+
92+
onlyIf { System.getenv("BINTRAY_USER").isNotEmpty() }
93+
onlyIf { System.getenv("BINTRAY_APIKEY").isNotEmpty() }
94+
95+
doFirst {
96+
println("Generating Maven POM file to $buildDir/poms/pom-default.xml")
97+
maven.pom {
98+
project {
99+
withGroovyBuilder {
100+
"name"(artifactId)
101+
"description"(shortDesc)
102+
"url"("https://github.com/$repoName")
103+
"licenses" {
104+
"license" {
105+
"name"("The 3-Clause BSD License")
106+
"url"("https://opensource.org/licenses/BSD-3-Clause")
107+
"distribution"("repo")
108+
}
109+
}
110+
"developers" {
111+
"developer" {
112+
"id"(orgName)
113+
"name"("$orgName, Inc.")
114+
"email"("[email protected]")
115+
}
116+
}
117+
"scm" {
118+
"connection"("scm:git:git://github.com/$repoName.git")
119+
"developerConnection"("scm:git:ssh://github.com/$repoName.git")
120+
"url"(repoUrl)
121+
}
122+
}
123+
}
124+
}
125+
.writeTo("$buildDir/poms/pom-default.xml")
126+
}
127+
}
128+
114129
bintray {
115130
user = System.getenv("BINTRAY_USER")
116131
key = System.getenv("BINTRAY_APIKEY")
@@ -154,6 +169,7 @@ bintray {
154169
artifacts {
155170
add("archives", tasks["jar"])
156171
add("archives", tasks["sourceJar"])
172+
add("archives", tasks["javadocJar"])
157173
}
158174

159175
tasks.test {

0 commit comments

Comments
 (0)