Skip to content

Commit 58cca42

Browse files
committed
Move maven publish plugin to project gradle.
1 parent 2fd2e8a commit 58cca42

File tree

2 files changed

+52
-47
lines changed

2 files changed

+52
-47
lines changed

build.gradle.kts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
44
plugins {
55
kotlin("jvm") version Kotlin.version
66
id(Spotless.spotless) version Spotless.version
7+
`java-library`
8+
`maven-publish`
79
}
810

911
val grpcVersion = "1.27.2"
@@ -77,6 +79,7 @@ allprojects {
7779

7880
subprojects {
7981
apply(plugin = "org.jetbrains.kotlin.jvm")
82+
apply(plugin = "maven-publish")
8083

8184
repositories {
8285
jcenter()
@@ -91,4 +94,53 @@ subprojects {
9194
testRuntimeOnly(Junit5.engine)
9295
testImplementation(Mockk.mockk)
9396
}
97+
98+
val artifactDescription = "dp-inntekt-grpc - gRPC client for fetching inntekt in Dagpenger context"
99+
val repoUrl = "https://github.com/navikt/dp-inntekt.git"
100+
val scmUrl = "scm:git:https://github.com/navikt/dp-inntekt.git"
101+
102+
val sourcesJar by tasks.registering(Jar::class) {
103+
archiveClassifier.set("sources")
104+
from(sourceSets["main"].allSource)
105+
}
106+
107+
artifacts {
108+
add("archives", sourcesJar)
109+
}
110+
111+
publishing {
112+
publications {
113+
create<MavenPublication>("maven") {
114+
from(components["java"])
115+
artifact(sourcesJar.get())
116+
117+
pom {
118+
description.set(artifactDescription)
119+
name.set(project.name)
120+
url.set(repoUrl)
121+
withXml {
122+
asNode().appendNode("packaging", "jar")
123+
}
124+
licenses {
125+
license {
126+
name.set("MIT License")
127+
name.set("https://opensource.org/licenses/MIT")
128+
}
129+
}
130+
developers {
131+
developer {
132+
organization.set("NAV (Arbeids- og velferdsdirektoratet) - The Norwegian Labour and Welfare Administration")
133+
organizationUrl.set("https://www.nav.no")
134+
}
135+
}
136+
137+
scm {
138+
connection.set(scmUrl)
139+
developerConnection.set(scmUrl)
140+
url.set(repoUrl)
141+
}
142+
}
143+
}
144+
}
145+
}
94146
}

dp-inntekt-grpc/build.gradle.kts

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ val protobufGradleVersion = "0.8.12"
88
plugins {
99
kotlin("jvm")
1010
id("com.google.protobuf") version "0.8.12"
11-
`java-library`
12-
`maven-publish`
1311
}
1412

1513
apply(plugin = "com.google.protobuf")
@@ -104,48 +102,3 @@ sourceSets {
104102
}
105103
}
106104
}
107-
108-
val artifactDescription = "dp-inntekt-grpc - gRPC client for fetching inntekt in Dagpenger context"
109-
val repoUrl = "https://github.com/navikt/dp-inntekt.git"
110-
val scmUrl = "scm:git:https://github.com/navikt/dp-inntekt.git"
111-
112-
val sourcesJar by tasks.registering(Jar::class) {
113-
archiveClassifier.set("sources")
114-
from(sourceSets["main"].allSource)
115-
}
116-
117-
publishing {
118-
publications {
119-
create<MavenPublication>("maven") {
120-
from(components["java"])
121-
artifact(sourcesJar.get())
122-
123-
pom {
124-
description.set(artifactDescription)
125-
name.set(project.name)
126-
url.set(repoUrl)
127-
withXml {
128-
asNode().appendNode("packaging", "jar")
129-
}
130-
licenses {
131-
license {
132-
name.set("MIT License")
133-
name.set("https://opensource.org/licenses/MIT")
134-
}
135-
}
136-
developers {
137-
developer {
138-
organization.set("NAV (Arbeids- og velferdsdirektoratet) - The Norwegian Labour and Welfare Administration")
139-
organizationUrl.set("https://www.nav.no")
140-
}
141-
}
142-
143-
scm {
144-
connection.set(scmUrl)
145-
developerConnection.set(scmUrl)
146-
url.set(repoUrl)
147-
}
148-
}
149-
}
150-
}
151-
}

0 commit comments

Comments
 (0)