Skip to content

Commit 44f7acd

Browse files
committed
publishing correct JVM version compatibility
1 parent d4eed69 commit 44f7acd

File tree

3 files changed

+38
-26
lines changed

3 files changed

+38
-26
lines changed

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* Support for NAT and reverse proxy scenarios: `ippClient.onExchangeOverrideRequestPrinterOrJobUri`
1010
* Support printer firmware attributes: `ippPrinter.printerFirmware`
1111
* Fixed issue where unknown (not IANA registered) attributes could not be added to a request
12+
* In publications `module.json` indicate the correct JVM version compatibility
1213

1314
Previous Versions
1415
-----------------

build.gradle.kts

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,43 @@ dependencies {
3636
defaultTasks("assemble")
3737

3838
// https://docs.gradle.org/current/userguide/compatibility.html
39-
val javaVersion = "1.8" // JvmTarget.JVM_1_6, default depends on kotlin release
40-
val kotlinVersion = "1.7"
4139
tasks.apply {
4240

43-
// // Kotlin
44-
// compileKotlin {
45-
// kotlinOptions {
46-
// jvmTarget = javaVersion
47-
// languageVersion = kotlinVersion
48-
// }
49-
// }
50-
// compileTestKotlin {
51-
// kotlinOptions {
52-
// jvmTarget = javaVersion
53-
// languageVersion = kotlinVersion
54-
// }
55-
// }
41+
// class files versions depend on Kotlin compiler (default is 1.8)
42+
// module.json includes "org.gradle.jvm.version" of jdk used by gradle
43+
// https://docs.gradle.org/8.5/userguide/variant_attributes.html#sub:jvm_default_attributes
44+
// for other projects using gradle this could cause issues like
45+
// "Incompatible because this component declares a component,
46+
// compatible with Java 21 and the consumer needed a component, compatible with Java 17"
47+
// Hence we explicitly set the Kotlin and Java version here
48+
49+
val javaVersion = "1.8" // JvmTarget.JVM_1_6, default depends on kotlin release
50+
val kotlinVersion = "1.7"
51+
52+
// Kotlin
53+
compileKotlin {
54+
kotlinOptions {
55+
jvmTarget = javaVersion
56+
languageVersion = kotlinVersion
57+
}
58+
}
59+
compileTestKotlin {
60+
kotlinOptions {
61+
jvmTarget = javaVersion
62+
languageVersion = kotlinVersion
63+
}
64+
}
65+
66+
// Java
67+
compileJava {
68+
sourceCompatibility = javaVersion
69+
targetCompatibility = javaVersion
70+
}
71+
compileTestJava {
72+
sourceCompatibility = javaVersion
73+
targetCompatibility = javaVersion
74+
}
5675

57-
// Java
58-
// compileJava {
59-
// sourceCompatibility = javaVersion
60-
// targetCompatibility = javaVersion
61-
// }
62-
// compileTestJava {
63-
// sourceCompatibility = javaVersion
64-
// targetCompatibility = javaVersion
65-
// }
6676
jar {
6777
manifest {
6878
attributes(
@@ -113,8 +123,9 @@ publishing {
113123
// https://central.sonatype.org/publish/publish-portal-snapshots/#publishing-snapshot-releases-for-your-project
114124
// https://central.sonatype.com/repository/maven-snapshots/
115125
// https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/
126+
val isSNAPSHOT = version.toString().endsWith("-SNAPSHOT")
116127
url = uri(
117-
if (version.toString().endsWith("-SNAPSHOT")) "https://central.sonatype.com/repository/maven-snapshots/"
128+
if (isSNAPSHOT) "https://central.sonatype.com/repository/maven-snapshots/"
118129
else "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"
119130
)
120131
println("> publish.url: $url")

src/main/kotlin/de/gmuth/ipp/client/IppPrinter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ open class IppPrinter(
682682
if (attributes.containsKey("printer-name")) append(" $name")
683683
if (attributes.containsKey("printer-make-and-model")) append(" ($makeAndModel)")
684684
append(", state=$state, stateReasons=$stateReasons")
685-
stateMessage?.let { if (it.text.isNotEmpty()) append(", stateMessage=$stateMessage") }
685+
stateMessage.let { if (it.text.isNotEmpty()) append(", stateMessage=$stateMessage") }
686686
if (attributes.containsKey("printer-is-accepting-jobs")) append(", isAcceptingJobs=$isAcceptingJobs")
687687
if (attributes.containsKey("printer-location")) append(", location=$location")
688688
if (attributes.containsKey("printer-info")) append(", info=$info")

0 commit comments

Comments
 (0)