1+ import com.vanniktech.maven.publish.JavaLibrary
2+ import com.vanniktech.maven.publish.JavadocJar
3+ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4+
15group = " cz.smarteon"
26
37scmVersion {
@@ -11,20 +15,20 @@ project.version = scmVersion.version
1115
1216plugins {
1317 `java- library`
14- signing
15- `maven- publish`
1618 jacoco
1719 id(" pl.allegro.tech.build.axion-release" ) version " 1.18.18"
18- id(" org.danilopianini. publish-on-central " ) version " 8.0.7 "
20+ id(" com.vanniktech.maven. publish" ) version " 0.34.0 "
1921 id(" ru.vyarus.quality" ) version " 6.0.1"
20- kotlin(" jvm" ) version " 1.7.10 "
22+ kotlin(" jvm" ) version " 2.2.20 "
2123}
2224
2325java {
26+ toolchain {
27+ languageVersion.set(JavaLanguageVersion .of(17 ))
28+ }
2429 sourceCompatibility = JavaVersion .VERSION_11
2530 targetCompatibility = JavaVersion .VERSION_11
26- withJavadocJar()
27- withSourcesJar()
31+ // javadoc and sources configured in publishing plugin
2832}
2933
3034repositories {
@@ -58,6 +62,7 @@ dependencies {
5862 testImplementation(" org.junit.jupiter:junit-jupiter-api:$junitVersion " )
5963 testRuntimeOnly(" org.junit.jupiter:junit-jupiter-engine:$junitVersion " )
6064 testImplementation(" org.junit.jupiter:junit-jupiter-params:$junitVersion " )
65+ testRuntimeOnly(" org.junit.platform:junit-platform-launcher" )
6166
6267 val striktVersion = " 0.34.1"
6368 testImplementation(" io.strikt:strikt-core:$striktVersion " )
@@ -88,88 +93,59 @@ dependencies {
8893 testImplementation(" org.awaitility:awaitility-kotlin:4.1.1" )
8994}
9095
91- val ossUser: String? = System .getenv(" OSS_USER" )
92- val ossPass: String? = System .getenv(" OSS_PASS" )
93-
94- publishing {
95- publications {
96- create<MavenPublication >(" library" ) {
97- from(components[" java" ])
98-
99- pom {
100- name.set(project.name)
101- url.set(" https://github.com/Smarteon/loxone-java" )
102- description.set(" Java implementation of the Loxone™ communication protocol (Web Socket)" )
103- organization {
104- name.set(" Smarteon Systems s.r.o" )
105- url.set(" https://smarteon.cz" )
106- }
107- licenses {
108- license {
109- name.set(" 3-Clause BSD License" )
110- url.set(" https://opensource.org/licenses/BSD-3-Clause" )
111- distribution.set(" repo" )
112- }
113- }
114- developers {
115- developer {
116- name.set(" Jiří Mikulášek" )
117- email.set(" jiri.mikulasek@smarteon.cz" )
118- }
119- developer {
120- name.set(" Vojtěch Zavřel" )
121- email.set(" vojtech.zavrel@smarteon.cz" )
122- }
123- developer {
124- name.set(" Tomáš Knotek" )
125- email.set(" tomas.knotek@smarteon.cz" )
126- }
127- }
128- contributors {
129- contributor {
130- name.set(" Petr Žufan" )
131- }
132- }
133- scm {
134- url.set(" git@github.com:Smarteon/loxone-java.git" )
135- connection.set(" scm:git:git@github.com:Smarteon/loxone-java.git" )
136- tag.set(project.version.toString())
137- }
138- }
139- }
140- }
141- }
96+ // see https://vanniktech.github.io/gradle-maven-publish-plugin/central/#secrets for how to set up credentials and signing
97+ mavenPublishing {
98+ publishToMavenCentral(automaticRelease = true )
99+ signAllPublications()
142100
143- if (ossUser != null && ossPass != null ) {
144- publishOnCentral {
145- repoOwner.set( " Smarteon " )
146- projectDescription.set( " Java implementation of the Loxone™ communication protocol (Web Socket) " )
147- licenseName.set( " 3-Clause BSD License " )
148- licenseUrl.set( " https://opensource.org/licenses/BSD-3-Clause " )
101+ configure(
102+ JavaLibrary (
103+ javadocJar = JavadocJar . Javadoc (),
104+ sourcesJar = true ,
105+ )
106+ )
149107
150- repositories {
151- mavenCentral.user.set(ossUser)
152- mavenCentral.password.set(ossPass)
153- }
154- }
155- }
108+ coordinates(project.group.toString(), project.name, project.version.toString())
156109
157- val signingKey: String? = System .getenv(" SIGNING_KEY" )
158- val signingPassword: String? = System .getenv(" SIGNING_PASS" )
159- if (signingKey != null && signingPassword != null ) {
160- signing {
161- setRequired({
162- ! project.version.toString().endsWith(" -SNAPSHOT" )
163- })
164- useInMemoryPgpKeys(signingKey, signingPassword)
165- sign(publishing.publications[" library" ])
166- }
167- } else if (hasProperty(" signing.keyId" )) {
168- signing {
169- setRequired({
170- ! project.version.toString().endsWith(" -SNAPSHOT" )
171- })
172- sign(publishing.publications[" library" ])
110+ pom {
111+ name = project.name
112+ url = " https://github.com/Smarteon/loxone-java"
113+ description = " Java implementation of the Loxone™ communication protocol (Web Socket)"
114+ organization {
115+ name = " Smarteon Systems s.r.o"
116+ url = " https://smarteon.cz"
117+ }
118+ licenses {
119+ license {
120+ name = " 3-Clause BSD License"
121+ url = " https://opensource.org/licenses/BSD-3-Clause"
122+ distribution = " repo"
123+ }
124+ }
125+ developers {
126+ developer {
127+ name = " Jiří Mikulášek"
128+ email = " jiri.mikulasek@smarteon.cz"
129+ }
130+ developer {
131+ name = " Vojtěch Zavřel"
132+ email = " vojtech.zavrel@smarteon.cz"
133+ }
134+ developer {
135+ name = " Tomáš Knotek"
136+ email = " tomas.knotek@smarteon.cz"
137+ }
138+ }
139+ contributors {
140+ contributor {
141+ name = " Petr Žufan"
142+ }
143+ }
144+ scm {
145+ url = " git@github.com:Smarteon/loxone-java.git"
146+ connection = " scm:git:git@github.com:Smarteon/loxone-java.git"
147+ tag = project.version.toString()
148+ }
173149 }
174150}
175151
@@ -195,8 +171,8 @@ tasks {
195171 }
196172
197173 withType< org.jetbrains.kotlin.gradle.tasks.KotlinCompile > {
198- kotlinOptions {
199- jvmTarget = " 11 "
174+ compilerOptions {
175+ jvmTarget.set( JvmTarget . JVM_11 )
200176 }
201177 }
202178
0 commit comments