Skip to content

Getting Started

What is jkit

jkit is a pure-JDK, zero-dependency general-purpose Java utility library, migrated from ZmlTools. It keeps the original utility capabilities while removing every third-party dependency (Gson, Fastjson, OkHttp, Guava, Apache Commons CSV, Jsoup, SLF4J, Logback, Lombok, etc.) — only the JDK standard library is used.

  • Coordinates: com.alianga:jkit
  • Compilation target: JDK 8+
  • License: Apache License 2.0

Highlights:

  • Zero third-party dependencies: the <dependencies> section is empty, so adding jkit never leaks external libraries into your application — no version conflicts.
  • Dependency-free logging: a minimal facade com.alianga.jkit.log.Log built on java.util.logging, with an SLF4J-style API ({} placeholders, trailing Throwable prints the stack trace).
  • Pure-JDK rewrites: CSV, JSON and every other utility are implemented without any external library.

Modules

This repository is a multi-module build rooted at jkit-parent. Pull in only what you need:

ModuleCoordinatesDescription
jkit-corecom.alianga:jkitRuntime core (strings, dates, JSON, YAML, HTTP, configuration, …)
jkit-sqlcom.alianga:jkit-sqlHand-written zero-dependency SQL parser matching the common entry points of Druid / JSqlParser
jkit-sql-autocom.alianga:jkit-sql-autoCreate / update tables from entities at startup (JDBC)
jkit-sql-auto-spring-boot-2com.alianga:jkit-sql-auto-spring-boot-2Spring Boot 2 auto-config
jkit-sql-auto-spring-boot-3com.alianga:jkit-sql-auto-spring-boot-3Spring Boot 3 auto-config (JDK 17+)
jkit-notifycom.alianga:jkit-notifyNotifications: DingTalk / WeCom / Feishu / ServerChan / Bark / Webhook / SMTP
jkit-notify-extracom.alianga:jkit-notify-extraOptional channels: Slack / Telegram / ntfy / SMS (Alibaba Cloud, Tencent Cloud, Yunpian, Huawei Cloud)
jkit-curl-codegencom.alianga:jkit-curl-codegenConvert curl commands into OkHttp / fetch / requests and other source code

Add the dependency

Core library:

xml
<dependency>
    <groupId>com.alianga</groupId>
    <artifactId>jkit</artifactId>
    <version>2.0.1</version>
</dependency>

Optional modules:

xml
<dependency>
    <groupId>com.alianga</groupId>
    <artifactId>jkit-sql</artifactId>
    <version>2.0.1</version>
</dependency>
xml
<dependency>
    <groupId>com.alianga</groupId>
    <artifactId>jkit-sql-auto</artifactId>
    <version>2.0.1</version>
</dependency>
xml
<dependency>
    <groupId>com.alianga</groupId>
    <artifactId>jkit-sql-auto-spring-boot-2</artifactId>
    <version>2.0.1</version>
</dependency>
xml
<dependency>
    <groupId>com.alianga</groupId>
    <artifactId>jkit-sql-auto-spring-boot-3</artifactId>
    <version>2.0.1</version>
</dependency>
xml
<dependency>
    <groupId>com.alianga</groupId>
    <artifactId>jkit-notify</artifactId>
    <version>2.0.1</version>
</dependency>
xml
<dependency>
    <groupId>com.alianga</groupId>
    <artifactId>jkit-notify-extra</artifactId>
    <version>2.0.1</version>
</dependency>
xml
<dependency>
    <groupId>com.alianga</groupId>
    <artifactId>jkit-curl-codegen</artifactId>
    <version>2.0.1</version>
</dependency>

Auto schema (optional)

jkit-sql only generates SQL. To create / update tables at startup, pick one artifact. Full guide: Auto schema.

ProjectArtifactStartup code
Plain Javajkit-sql-autoCall SqlAuto.run(...) once
Spring Boot 2jkit-sql-auto-spring-boot-2None. Set jkit.sql.auto.packages
Spring Boot 3jkit-sql-auto-spring-boot-3Same

Minimal Spring Boot config:

yaml
spring:
  datasource:
    url: jdbc:postgresql://localhost:5432/shop
    username: shop
    password: secret
jkit:
  sql:
    auto:
      packages: com.example.entity
      mode: update

Your first program

The basic utilities are static-method based — no setup objects required:

java
import com.alianga.jkit.csv.CSVUtils;
import com.alianga.jkit.DateUtils;
import com.alianga.jkit.common.idgenerate.SnowFlakeIdWorker;
import com.alianga.jkit.StringUtils;
import com.alianga.jkit.log.Log;

import java.io.File;
import java.util.Arrays;
import java.util.List;

public class QuickStart {
    private static final Log log = Log.get(QuickStart.class);

    public static void main(String[] args) throws Exception {
        boolean blank = StringUtils.isBlank("  ");          // true
        String now = DateUtils.getNowDateTime();            // yyyy-MM-dd HH:mm:ss
        long id = SnowFlakeIdWorker.INSTANCE.nextId();      // snowflake ID

        List<List<String>> rows = Arrays.asList(
                Arrays.asList("Tom", "18"),
                Arrays.asList("Lucy", "20"));
        CSVUtils.write(new File("target/users.csv"), rows, "name", "age");
        List<List<String>> back = CSVUtils.read(new File("target/users.csv"));

        log.info("id={}, now={}", id, now);
    }
}
TopicDocs
Strings, collections, crypto, reflection, thread poolsMisc Utilities
Files, resources, properties, file monitoringIO & Resources
Serialization, POJO binding, JSONNode, JSONPath, SchemaJSON
YAML parsing, node tree, anchors, multi-documentsYAML
Spring Boot-style externalized configurationConfiguration
GET/POST, upload & download, SSE, load balancingHTTP Client
Multi-dialect SQL parsing, formatting, pagination rewriteSQL Parsing
DingTalk / WeCom / Feishu / email notificationsNotification

Migrating from ZmlTools

The Maven coordinates moved from top.wuyongshi:ZmlTools to com.alianga:jkit, and the package prefix from top.wys.utils.* to com.alianga.jkit.*:

  1. Edit your POM (recommended): switch the groupId / artifactId to com.alianga:jkit:2.0.1 and rewrite top.wys.utils.* imports to com.alianga.jkit.*.
  2. Maven relocation: after publishing relocated/zmltools/pom.xml, builds depending on the old coordinates are redirected automatically (imports still need manual rewriting).

Limitations & compatibility

  • Source and bytecode target JDK 8; JDK 9+ works, but the JSON Unsafe fast path is subject to runtime module permissions — call JSONVmOptions.forceRequiredMemoryAlignment() if needed.
  • The published jar carries no runtime third-party dependencies; JUnit is test-scoped only.
  • sun.misc.Unsafe is used purely for performance; application code should not rely on the internal json.internal packages.
  • Crypto helpers, file writers and network helpers do not manage keys, path safety, timeouts or certificate policies for you.

Build from source

bash
# Use a JDK 8 provided via environment variables (JAVA8_HOME or JDK8_HOME)
export JAVA_HOME="${JAVA8_HOME:-${JDK8_HOME}}"
export PATH="$JAVA_HOME/bin:$PATH"

mvn package   # compile & package (dependency-free, fast)
mvn test      # run unit tests (JUnit 4, test scope)
mvn install   # install to the local repository

Released under the Apache License 2.0