Read plugin version from MANIFEST

This commit is contained in:
grimsi
2025-06-05 19:23:04 +02:00
parent c983f93603
commit f398226f44
+9
View File
@@ -1,3 +1,5 @@
import java.util.jar.Manifest
plugins {
kotlin("jvm")
}
@@ -9,6 +11,13 @@ subprojects {
compileOnly(project(":plugin-api"))
}
// Read the version from the MANIFEST.MF file in resources
val manifestFile = file("src/main/resources/MANIFEST.MF")
val manifestVersion: String? = if (manifestFile.exists()) {
Manifest(manifestFile.inputStream()).mainAttributes.getValue("Plugin-Version")
} else null
version = manifestVersion ?: "1.0-SNAPSHOT"
tasks.jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
isZip64 = true