Building a Japanese Language Analysis Tool with Java, Kotlin, Spring Boot, and Gradle (Multi‑module Project)
This article details the creation of a Japanese language analysis tool using Java, Kotlin, Spring Boot, and Gradle, explaining the multi‑module project structure, parent and child Gradle configurations, integration of Swing UI with an embedded Chromium engine, and practical tips for mixing Java and Kotlin code.
This article introduces a personal project started in September of the author's first year of graduate school: a Japanese language analysis tool built with Java, Kotlin, Spring Boot, Gradle, and Swing. The author highlights three technical characteristics of the project: running a Swing UI inside a Spring Boot application, using a Gradle parent‑child multi‑module setup with Kotlin mixed in, and embedding a Chromium engine for displaying a personal website.
Technical stack : Java, Kotlin, Swing, Spring Boot, Gradle (KTS DSL), Lombok, RxJava, FastJSON2, Commons‑IO, and several UI libraries (FlatLaf, JTattoo). The runtime environment is JetBrains Runtime with JCEF (Java 21).
Parent module configuration – the root settings.gradle.kts declares all sub‑modules:
rootProject.name = "cable-car"
include(":1-common")
include(":1-reactivex")
include(":1-spring-application")
include(":2-jp-analysis-core")
include(":3-client-framework")
include(":4-web-jp-learning")The root build.gradle.kts defines the Java version, plugins, repositories, and common tasks:
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
group = "com.hu.cablecar"
version = "0.0.1"
description = "缆车"
// Java version
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
// Plugins for Java, Kotlin, Lombok
plugins {
java
kotlin("jvm") version "1.9.24"
kotlin("plugin.lombok") version "1.9.24"
id("io.freefair.lombok") version "8.10"
}
// Repository configuration
allprojects {
repositories {
maven { url = uri("https://maven.aliyun.com/nexus/content/groups/public/") }
mavenCentral()
mavenLocal()
}
tasks.withType
{ options.encoding = "UTF-8" }
tasks.withType
{ options.encoding = "UTF-8" }
tasks.withType
{
kotlinOptions { freeCompilerArgs = listOf("-Xjsr305=strict"); jvmTarget = "21" }
}
}The configuration performs three main actions: sets the Java version, applies Java/Kotlin/Lombok support to all sub‑modules, and configures Maven repository URLs.
Sub‑module overview :
1-common – a simple module containing three Java utility classes and a FastJSON2 dependency. description = "公共基础模块" dependencies { implementation("com.alibaba.fastjson2:fastjson2:2.0.45") }
1-reactivex – provides RxJava‑based publish/subscribe functionality and depends on 1-common . description = "RX" dependencies { implementation(project(":1-common")) implementation("io.reactivex.rxjava3:rxjava:3.1.9") }
2-jp-analysis-core – the core Japanese text analysis module, pulling in Commons‑IO and 1-common . description = "日语分析核心模块" plugins { } dependencies { implementation(project(":1-common")) implementation("commons-io:commons-io:2.15.1") }
3-client-framework – the main UI module that launches the Swing interface via Spring Boot, mixes Java and Kotlin, and bundles several UI JARs. It also declares all other sub‑modules as dependencies. description = "客户端UI框架" plugins { kotlin("plugin.spring") version "1.9.24" id("org.springframework.boot") version "3.3.4" id("io.spring.dependency-management") version "1.1.6" } dependencies { implementation(project(":1-common")) implementation(project(":1-reactivex")) implementation(project(":1-spring-application")) implementation(project(":2-jp-analysis-core")) implementation(project(":4-web-jp-learning")) implementation("org.springframework.boot:spring-boot-starter") implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.boot:spring-boot-starter-tomcat") implementation("io.reactivex.rxjava3:rxjava") implementation("commons-io:commons-io:2.15.1") implementation(files("lib/ui/flatlaf-3.5.2.jar")) implementation(files("lib/ui/flatlaf-intellij-themes-3.5.2.jar")) implementation(files("lib/ui/JTattoo-1.6.13.jar")) } tasks.jar { enabled = true manifest { attributes(mapOf("Main-Class" to "com.hu.cablecar.client.framework.ClientFrameworkApplication")) } }
By focusing on the three Gradle files ( settings.gradle.kts , root build.gradle.kts , and each module's build.gradle.kts ), the author demonstrates that a complex multi‑module Java/Kotlin project can be configured concisely compared to an equivalent Maven setup.
The UI module embeds a Chromium engine to display the author's personal website (a Japanese learning blog), and the Swing interface is built with the author's own expertise.
In summary, the article provides a step‑by‑step guide to setting up a Gradle‑based parent‑child project that mixes Java and Kotlin, integrates Spring Boot, Swing, and Chromium, and shows how to package the application as a runnable JAR.
Rare Earth Juejin Tech Community
Juejin, a tech community that helps developers grow.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.