Skip to content

Commit e7ff4d6

Browse files
Use gradle-maven-publish plugin
1 parent 4825144 commit e7ff4d6

4 files changed

Lines changed: 38 additions & 57 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: ci
33
jobs:
44
build:
55
runs-on: ubuntu-latest
6-
76
steps:
87
- uses: actions/checkout@v2
98
- name: Set up JDK 21

build.gradle.kts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
}
99

1010
group = "dev.eidentification"
11-
version = "0.15.0-SNAPSHOT"
11+
version = "0.15.0"
1212

1313
java {
1414
sourceCompatibility = JavaVersion.VERSION_21
@@ -31,11 +31,6 @@ dependencies {
3131
testRuntimeOnly(libs.junit.jupiter.engine)
3232
}
3333

34-
java {
35-
withSourcesJar()
36-
withJavadocJar()
37-
}
38-
3934
tasks {
4035
javadoc {
4136
options {
@@ -45,6 +40,10 @@ tasks {
4540
}
4641
}
4742

43+
tasks.withType<Javadoc>().configureEach {
44+
setDestinationDir(layout.projectDirectory.file("docs/").asFile)
45+
}
46+
4847
tasks.register("code-quality") {
4948
description = "Run Checkstyle, SpotBugs and ErrorProne analysis on both main and test classes"
5049
group = "code-quality"

gradle/plugins/publish/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ repositories {
1010
}
1111

1212
dependencies {
13-
13+
implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0-rc1")
1414
}
Lines changed: 32 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,42 @@
1-
import java.net.URI
2-
31
plugins {
42
id("java-library")
53
id("java-gradle-plugin")
6-
id("maven-publish")
7-
id("signing")
4+
id("com.vanniktech.maven.publish")
85
}
96

10-
tasks.withType<Javadoc>().configureEach {
11-
setDestinationDir(layout.projectDirectory.file("docs/").asFile)
7+
afterEvaluate {
8+
tasks.named("generateMetadataFileForPluginMavenPublication") {
9+
dependsOn("plainJavadocJar")
10+
}
1211
}
1312

14-
publishing {
15-
repositories {
16-
maven {
17-
name = "ossrh"
18-
url = URI.create("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
19-
credentials {
20-
username = findProperty("ossrhUsername").toString()
21-
password = findProperty("ossrhPassword").toString()
22-
}
23-
}
24-
}
13+
mavenPublishing {
14+
coordinates("dev.eidentification", "bankid-sdk", version = version.toString())
2515

26-
publications {
27-
create<MavenPublication>("maven") {
28-
from(components["java"])
29-
pom {
30-
name = "BankID SDK"
31-
artifactId = "bankid-sdk"
32-
description = "A SDK to interact with the BankID API"
33-
url = "https://github.com/NicklasWallgren/bankid-java"
34-
scm {
35-
connection = "scm:git:git://github.com/NicklasWallgren/bankid-java.git"
36-
developerConnection = "scm:git:ssh://github.com/NicklasWallgren/bankid-java.git"
37-
url = "https://github.com/NicklasWallgren/bankid-java"
38-
}
39-
licenses {
40-
license {
41-
name = "MIT Licence"
42-
url = "https://github.com/NicklasWallgren/bankid-java/blob/master/LICENSE"
43-
}
44-
}
45-
developers {
46-
developer {
47-
id = "nicklas"
48-
name = "NicklasWallgren"
49-
email = "nicklas.wallgren@gmail.com"
50-
}
51-
}
52-
}
53-
}
54-
}
55-
}
16+
signAllPublications()
5617

57-
signing {
58-
sign(publishing.publications["maven"])
18+
pom {
19+
name.set("BankID SDK")
20+
description.set("A SDK to interact with the BankID API.")
21+
url.set("https://github.com/NicklasWallgren/bankid-java")
22+
licenses {
23+
license {
24+
name.set("MIT Licence")
25+
url.set("https://github.com/NicklasWallgren/bankid-java/blob/master/LICENSE")
26+
distribution.set("https://github.com/NicklasWallgren/bankid-java/blob/master/LICENSE")
27+
}
28+
}
29+
developers {
30+
developer {
31+
id.set("nicklas")
32+
name.set("NicklasWallgren")
33+
url.set("nicklas.wallgren@gmail.com")
34+
}
35+
}
36+
scm {
37+
url.set("https://github.com/NicklasWallgren/bankid-java")
38+
connection.set("scm:git:git://github.com/NicklasWallgren/bankid-java.git")
39+
developerConnection.set("scm:git:ssh://github.com/NicklasWallgren/bankid-java.git")
40+
}
41+
}
5942
}

0 commit comments

Comments
 (0)