From 99ba2e86a66aca60985a23df7e976ed2a80c14b9 Mon Sep 17 00:00:00 2001 From: Alp Tuna Dagdanas Date: Thu, 18 Dec 2025 17:26:51 +0300 Subject: [PATCH 1/8] update --- build.gradle.kts | 55 ++++++------------- .../RuntimeHintsAutoConfiguration.kt | 9 +++ .../ftp/hints/CustomRuntimeHintsRegistrar.kt | 39 +++++++++++++ ...ot.autoconfigure.AutoConfiguration.imports | 1 + 4 files changed, 66 insertions(+), 38 deletions(-) create mode 100644 src/main/kotlin/com/valensas/ftp/autoconfigure/RuntimeHintsAutoConfiguration.kt create mode 100644 src/main/kotlin/com/valensas/ftp/hints/CustomRuntimeHintsRegistrar.kt create mode 100644 src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports diff --git a/build.gradle.kts b/build.gradle.kts index 68ae096..7bbfa1d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,16 +9,29 @@ plugins { id("com.github.ben-manes.versions") version "0.51.0" id("org.springframework.boot") version "3.5.6" id("io.spring.dependency-management") version "1.1.7" - id("net.thebugmc.gradle.sonatype-central-portal-publisher") version "1.2.3" id("maven-publish") } group = "com.valensas" +version = "145.15.12" java.sourceCompatibility = JavaVersion.VERSION_21 repositories { mavenCentral() + if (project.hasProperty("GITLAB_REPO_URL")) { + maven { + name = "Gitlab" + url = uri(project.property("GITLAB_REPO_URL").toString()) + credentials(HttpHeaderCredentials::class.java) { + name = project.findProperty("GITLAB_TOKEN_NAME")?.toString() + value = project.findProperty("GITLAB_TOKEN")?.toString() + } + authentication { + create("header", HttpHeaderAuthentication::class) + } + } + } mavenLocal() } @@ -28,10 +41,12 @@ tasks.getByName("jar") { dependencies { implementation("org.springframework.boot:spring-boot-starter") + implementation("org.springframework.data:spring-data-commons") implementation("org.jetbrains.kotlin:kotlin-reflect") testImplementation("org.springframework.boot:spring-boot-starter-test") testImplementation("org.jetbrains.kotlin:kotlin-test-junit5") testRuntimeOnly("org.junit.platform:junit-platform-launcher") + implementation("com.valensas:graalvm-native-support:1.0.4") // Ftp implementation("commons-net:commons-net:3.12.0") @@ -69,43 +84,7 @@ publishing { publications { create("mavenJava") { from(components["java"]) - } + } } } -signing { - val keyId = System.getenv("SIGNING_KEYID") - val secretKey = System.getenv("SIGNING_SECRETKEY") - val passphrase = System.getenv("SIGNING_PASSPHRASE") - - useInMemoryPgpKeys(keyId, secretKey, passphrase) -} - -centralPortal { - username = System.getenv("SONATYPE_USERNAME") - password = System.getenv("SONATYPE_PASSWORD") - - pom { - name = "Java Ftp" - description = "This library contains embedded ftp server and ftp factory which supports ftp, ftps, sftp." - url = "https://valensas.com/" - scm { - url = "https://github.com/Valensas/java-ftp" - } - - licenses { - license { - name.set("The Apache License, Version 2.0") - url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") - } - } - - developers { - developer { - id.set("0") - name.set("Valensas") - email.set("info@valensas.com") - } - } - } -} diff --git a/src/main/kotlin/com/valensas/ftp/autoconfigure/RuntimeHintsAutoConfiguration.kt b/src/main/kotlin/com/valensas/ftp/autoconfigure/RuntimeHintsAutoConfiguration.kt new file mode 100644 index 0000000..a499058 --- /dev/null +++ b/src/main/kotlin/com/valensas/ftp/autoconfigure/RuntimeHintsAutoConfiguration.kt @@ -0,0 +1,9 @@ +package com.valensas.ftp.autoconfigure + +import com.valensas.ftp.hints.CustomRuntimeHintsRegistrar +import org.springframework.context.annotation.Configuration +import org.springframework.context.annotation.ImportRuntimeHints + +@Configuration +@ImportRuntimeHints(CustomRuntimeHintsRegistrar::class) +class RuntimeHintsAutoConfiguration diff --git a/src/main/kotlin/com/valensas/ftp/hints/CustomRuntimeHintsRegistrar.kt b/src/main/kotlin/com/valensas/ftp/hints/CustomRuntimeHintsRegistrar.kt new file mode 100644 index 0000000..5d29f18 --- /dev/null +++ b/src/main/kotlin/com/valensas/ftp/hints/CustomRuntimeHintsRegistrar.kt @@ -0,0 +1,39 @@ +package com.valensas.ftp.hints + +import com.valensas.nativesupport.hints.HintUtils +import org.slf4j.LoggerFactory +import org.springframework.aot.hint.MemberCategory +import org.springframework.aot.hint.RuntimeHints +import org.springframework.aot.hint.RuntimeHintsRegistrar +import org.springframework.data.util.TypeScanner + +class CustomRuntimeHintsRegistrar : RuntimeHintsRegistrar { + + private val logger = LoggerFactory.getLogger(javaClass) + + override fun registerHints( + hints: RuntimeHints, + classLoader: ClassLoader? + ) { + val packages = listOf("com.valensas.ftp.model",) + + logger.info( + "Setting reflection hints for classes in packages: {}", + packages.joinToString(", ") + ) + + TypeScanner + .typeScanner(requireNotNull(classLoader)) + .scanPackages(packages) + .forEach { clazz -> + hints.reflection() + .registerType(clazz, *MemberCategory.entries.toTypedArray()) + + HintUtils.registerSerializationHints( + hints, + clazz, + classLoader + ) + } + } +} diff --git a/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..8070d18 --- /dev/null +++ b/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.valensas.ftp.autoconfigure.RuntimeHintsAutoConfiguration \ No newline at end of file From 5a43d8fd421c4575f66d2bd8da276825d257150c Mon Sep 17 00:00:00 2001 From: Alp Tuna Dagdanas Date: Fri, 19 Dec 2025 13:11:33 +0300 Subject: [PATCH 2/8] update version --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7bbfa1d..0b4925a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,7 @@ plugins { } group = "com.valensas" -version = "145.15.12" +version = "0.2.23" java.sourceCompatibility = JavaVersion.VERSION_21 From da19a77856eac85a86877991213e836efc2c9fe0 Mon Sep 17 00:00:00 2001 From: Alp Tuna Dagdanas Date: Fri, 19 Dec 2025 17:00:27 +0300 Subject: [PATCH 3/8] update --- build.gradle.kts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 0b4925a..888cfb0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,6 +10,7 @@ plugins { id("org.springframework.boot") version "3.5.6" id("io.spring.dependency-management") version "1.1.7" id("maven-publish") + id("net.thebugmc.gradle.sonatype-central-portal-publisher") version "1.2.3" } group = "com.valensas" @@ -88,3 +89,40 @@ publishing { } } +signing { + val keyId = System.getenv("SIGNING_KEYID") + val secretKey = System.getenv("SIGNING_SECRETKEY") + val passphrase = System.getenv("SIGNING_PASSPHRASE") + + useInMemoryPgpKeys(keyId, secretKey, passphrase) +} + +centralPortal { + username = System.getenv("SONATYPE_USERNAME") + password = System.getenv("SONATYPE_PASSWORD") + + pom { + name = "Java Ftp" + description = "This library contains embedded ftp server and ftp factory which supports ftp, ftps, sftp." + url = "https://valensas.com/" + scm { + url = "https://github.com/Valensas/java-ftp" + } + + licenses { + license { + name.set("The Apache License, Version 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + } + } + + developers { + developer { + id.set("0") + name.set("Valensas") + email.set("info@valensas.com") + } + } + } +} + From 7b0b890998f3ca15e0bda93851800ec7d3fe2fb2 Mon Sep 17 00:00:00 2001 From: Alp Tuna Dagdanas Date: Thu, 25 Dec 2025 17:59:22 +0300 Subject: [PATCH 4/8] update runtimehintregistrar --- .../RuntimeHintsAutoConfiguration.kt | 6 +- .../ftp/hints/CustomRuntimeHintsRegistrar.kt | 12 ++-- .../ftp/hints/JschRuntimeHintsRegistrar.kt | 67 +++++++++++++++++++ 3 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 src/main/kotlin/com/valensas/ftp/hints/JschRuntimeHintsRegistrar.kt diff --git a/src/main/kotlin/com/valensas/ftp/autoconfigure/RuntimeHintsAutoConfiguration.kt b/src/main/kotlin/com/valensas/ftp/autoconfigure/RuntimeHintsAutoConfiguration.kt index a499058..f7f634c 100644 --- a/src/main/kotlin/com/valensas/ftp/autoconfigure/RuntimeHintsAutoConfiguration.kt +++ b/src/main/kotlin/com/valensas/ftp/autoconfigure/RuntimeHintsAutoConfiguration.kt @@ -1,9 +1,13 @@ package com.valensas.ftp.autoconfigure import com.valensas.ftp.hints.CustomRuntimeHintsRegistrar +import com.valensas.ftp.hints.JschRuntimeHintsRegistrar import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.ImportRuntimeHints @Configuration -@ImportRuntimeHints(CustomRuntimeHintsRegistrar::class) +@ImportRuntimeHints( + CustomRuntimeHintsRegistrar::class, + JschRuntimeHintsRegistrar::class, +) class RuntimeHintsAutoConfiguration diff --git a/src/main/kotlin/com/valensas/ftp/hints/CustomRuntimeHintsRegistrar.kt b/src/main/kotlin/com/valensas/ftp/hints/CustomRuntimeHintsRegistrar.kt index 5d29f18..91d57ea 100644 --- a/src/main/kotlin/com/valensas/ftp/hints/CustomRuntimeHintsRegistrar.kt +++ b/src/main/kotlin/com/valensas/ftp/hints/CustomRuntimeHintsRegistrar.kt @@ -8,31 +8,31 @@ import org.springframework.aot.hint.RuntimeHintsRegistrar import org.springframework.data.util.TypeScanner class CustomRuntimeHintsRegistrar : RuntimeHintsRegistrar { - private val logger = LoggerFactory.getLogger(javaClass) override fun registerHints( hints: RuntimeHints, - classLoader: ClassLoader? + classLoader: ClassLoader?, ) { - val packages = listOf("com.valensas.ftp.model",) + val packages = listOf("com.valensas.ftp.model") logger.info( "Setting reflection hints for classes in packages: {}", - packages.joinToString(", ") + packages.joinToString(", "), ) TypeScanner .typeScanner(requireNotNull(classLoader)) .scanPackages(packages) .forEach { clazz -> - hints.reflection() + hints + .reflection() .registerType(clazz, *MemberCategory.entries.toTypedArray()) HintUtils.registerSerializationHints( hints, clazz, - classLoader + classLoader, ) } } diff --git a/src/main/kotlin/com/valensas/ftp/hints/JschRuntimeHintsRegistrar.kt b/src/main/kotlin/com/valensas/ftp/hints/JschRuntimeHintsRegistrar.kt new file mode 100644 index 0000000..c8885b9 --- /dev/null +++ b/src/main/kotlin/com/valensas/ftp/hints/JschRuntimeHintsRegistrar.kt @@ -0,0 +1,67 @@ +package com.valensas.ftp.hints + +import org.springframework.aot.hint.MemberCategory +import org.springframework.aot.hint.RuntimeHints +import org.springframework.aot.hint.RuntimeHintsRegistrar + +class JschRuntimeHintsRegistrar : RuntimeHintsRegistrar { + override fun registerHints( + hints: RuntimeHints, + classLoader: ClassLoader?, + ) { + val reflection = hints.reflection() + + hints.resources().registerPattern("com/jcraft/jsch/**") + + listOf( + "javax.crypto.Cipher", + "javax.crypto.Mac", + "javax.crypto.KeyAgreement", + "java.security.MessageDigest", + "java.security.KeyPairGenerator", + "java.security.Signature", + ).forEach { + reflection.registerTypeIfPresent( + classLoader, + it, + ::configureForReflection, + ) + } + + val jschClasses = + """ + com.jcraft.jsch.JSch,com.jcraft.jsch.Session,com.jcraft.jsch.ChannelSftp, + com.jcraft.jsch.UserAuth,com.jcraft.jsch.UserAuthPassword, + com.jcraft.jsch.UserAuthPublicKey,com.jcraft.jsch.UserAuthKeyboardInteractive, + com.jcraft.jsch.UserAuthNone,com.jcraft.jsch.UserAuthGSSAPIWithMIC, + com.jcraft.jsch.jce.DH,com.jcraft.jsch.jce.Random, + com.jcraft.jsch.jce.AES128CBC,com.jcraft.jsch.jce.AES256CBC,com.jcraft.jsch.jce.AES128CTR, + com.jcraft.jsch.jce.TripleDESCBC,com.jcraft.jsch.jce.BlowfishCBC, + com.jcraft.jsch.jce.HMACSHA1,com.jcraft.jsch.jce.HMACSHA256,com.jcraft.jsch.jce.HMACMD5, + com.jcraft.jsch.jce.SHA1,com.jcraft.jsch.jce.SHA256,com.jcraft.jsch.jce.MD5, + com.jcraft.jsch.jce.SignatureRSA,com.jcraft.jsch.jce.SignatureDSA, + com.jcraft.jsch.jce.KeyPairGenRSA,com.jcraft.jsch.jce.KeyPairGenDSA, + com.jcraft.jsch.DHG1,com.jcraft.jsch.DHG14,com.jcraft.jsch.DHGEX, + com.jcraft.jsch.DHGEX256 + """.trimIndent() + .split(",") + .map { it.trim() } + .filter { it.isNotEmpty() } + + jschClasses.forEach { + reflection.registerTypeIfPresent( + classLoader, + it, + ::configureForReflection, + ) + } + } + + private fun configureForReflection(typeHint: org.springframework.aot.hint.TypeHint.Builder) { + typeHint.withMembers( + MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, + MemberCategory.INVOKE_DECLARED_METHODS, + MemberCategory.DECLARED_FIELDS, + ) + } +} From f3ddcfb049f28debd3c3c856623a8a543230e50e Mon Sep 17 00:00:00 2001 From: Alp Tuna Dagdanas Date: Thu, 25 Dec 2025 18:18:02 +0300 Subject: [PATCH 5/8] update build gradle --- build.gradle.kts | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 888cfb0..b17acf8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,19 +20,6 @@ java.sourceCompatibility = JavaVersion.VERSION_21 repositories { mavenCentral() - if (project.hasProperty("GITLAB_REPO_URL")) { - maven { - name = "Gitlab" - url = uri(project.property("GITLAB_REPO_URL").toString()) - credentials(HttpHeaderCredentials::class.java) { - name = project.findProperty("GITLAB_TOKEN_NAME")?.toString() - value = project.findProperty("GITLAB_TOKEN")?.toString() - } - authentication { - create("header", HttpHeaderAuthentication::class) - } - } - } mavenLocal() } From 1b01d65c89c322e67146ed26750dc17f40d721c3 Mon Sep 17 00:00:00 2001 From: Alp Tuna Dagdanas Date: Fri, 26 Dec 2025 14:32:36 +0300 Subject: [PATCH 6/8] convert string to list --- .../ftp/hints/JschRuntimeHintsRegistrar.kt | 50 ++++++++++++------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/src/main/kotlin/com/valensas/ftp/hints/JschRuntimeHintsRegistrar.kt b/src/main/kotlin/com/valensas/ftp/hints/JschRuntimeHintsRegistrar.kt index c8885b9..49094fb 100644 --- a/src/main/kotlin/com/valensas/ftp/hints/JschRuntimeHintsRegistrar.kt +++ b/src/main/kotlin/com/valensas/ftp/hints/JschRuntimeHintsRegistrar.kt @@ -29,24 +29,38 @@ class JschRuntimeHintsRegistrar : RuntimeHintsRegistrar { } val jschClasses = - """ - com.jcraft.jsch.JSch,com.jcraft.jsch.Session,com.jcraft.jsch.ChannelSftp, - com.jcraft.jsch.UserAuth,com.jcraft.jsch.UserAuthPassword, - com.jcraft.jsch.UserAuthPublicKey,com.jcraft.jsch.UserAuthKeyboardInteractive, - com.jcraft.jsch.UserAuthNone,com.jcraft.jsch.UserAuthGSSAPIWithMIC, - com.jcraft.jsch.jce.DH,com.jcraft.jsch.jce.Random, - com.jcraft.jsch.jce.AES128CBC,com.jcraft.jsch.jce.AES256CBC,com.jcraft.jsch.jce.AES128CTR, - com.jcraft.jsch.jce.TripleDESCBC,com.jcraft.jsch.jce.BlowfishCBC, - com.jcraft.jsch.jce.HMACSHA1,com.jcraft.jsch.jce.HMACSHA256,com.jcraft.jsch.jce.HMACMD5, - com.jcraft.jsch.jce.SHA1,com.jcraft.jsch.jce.SHA256,com.jcraft.jsch.jce.MD5, - com.jcraft.jsch.jce.SignatureRSA,com.jcraft.jsch.jce.SignatureDSA, - com.jcraft.jsch.jce.KeyPairGenRSA,com.jcraft.jsch.jce.KeyPairGenDSA, - com.jcraft.jsch.DHG1,com.jcraft.jsch.DHG14,com.jcraft.jsch.DHGEX, - com.jcraft.jsch.DHGEX256 - """.trimIndent() - .split(",") - .map { it.trim() } - .filter { it.isNotEmpty() } + listOf( + "com.jcraft.jsch.JSch", + "com.jcraft.jsch.Session", + "com.jcraft.jsch.ChannelSftp", + "com.jcraft.jsch.UserAuth", + "com.jcraft.jsch.UserAuthPassword", + "com.jcraft.jsch.UserAuthPublicKey", + "com.jcraft.jsch.UserAuthKeyboardInteractive", + "com.jcraft.jsch.UserAuthNone", + "com.jcraft.jsch.UserAuthGSSAPIWithMIC", + "com.jcraft.jsch.jce.DH", + "com.jcraft.jsch.jce.Random", + "com.jcraft.jsch.jce.AES128CBC", + "com.jcraft.jsch.jce.AES256CBC", + "com.jcraft.jsch.jce.AES128CTR", + "com.jcraft.jsch.jce.TripleDESCBC", + "com.jcraft.jsch.jce.BlowfishCBC", + "com.jcraft.jsch.jce.HMACSHA1", + "com.jcraft.jsch.jce.HMACSHA256", + "com.jcraft.jsch.jce.HMACMD5", + "com.jcraft.jsch.jce.SHA1", + "com.jcraft.jsch.jce.SHA256", + "com.jcraft.jsch.jce.MD5", + "com.jcraft.jsch.jce.SignatureRSA", + "com.jcraft.jsch.jce.SignatureDSA", + "com.jcraft.jsch.jce.KeyPairGenRSA", + "com.jcraft.jsch.jce.KeyPairGenDSA", + "com.jcraft.jsch.DHG1", + "com.jcraft.jsch.DHG14", + "com.jcraft.jsch.DHGEX", + "com.jcraft.jsch.DHGEX256", + ) jschClasses.forEach { reflection.registerTypeIfPresent( From 0669347da0959f623d6751007c4160ae91de8e09 Mon Sep 17 00:00:00 2001 From: Alp Tuna Dagdanas Date: Fri, 26 Dec 2025 14:33:06 +0300 Subject: [PATCH 7/8] update graalvm version --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index b17acf8..6d97073 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,7 @@ dependencies { testImplementation("org.springframework.boot:spring-boot-starter-test") testImplementation("org.jetbrains.kotlin:kotlin-test-junit5") testRuntimeOnly("org.junit.platform:junit-platform-launcher") - implementation("com.valensas:graalvm-native-support:1.0.4") + implementation("com.valensas:graalvm-native-support:1.0.5") // Ftp implementation("commons-net:commons-net:3.12.0") From d1c29eba7e542bd5b32fb248335da5b180cadc76 Mon Sep 17 00:00:00 2001 From: Alp Tuna Dagdanas Date: Fri, 26 Dec 2025 17:07:22 +0300 Subject: [PATCH 8/8] update graalvm version --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 6d97073..47f050c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,7 @@ dependencies { testImplementation("org.springframework.boot:spring-boot-starter-test") testImplementation("org.jetbrains.kotlin:kotlin-test-junit5") testRuntimeOnly("org.junit.platform:junit-platform-launcher") - implementation("com.valensas:graalvm-native-support:1.0.5") + implementation("com.valensas:graalvm-native-support:1.0.7") // Ftp implementation("commons-net:commons-net:3.12.0")