Backend Development 13 min read

Engineering Architecture Governance: Jar Package Management, IDEA Performance, and Maven Dependency Optimization at Kuaishou

This article details Kuaishou's engineering architecture governance process, covering project background, IDEA performance bottlenecks, cloud‑based IDE solutions, MavenHelper and custom Maven plugins for dependency analysis, handling NoClassDefFoundError issues, and static‑dynamic class dependency detection to improve backend build efficiency.

Kuaishou Tech
Kuaishou Tech
Kuaishou Tech
Engineering Architecture Governance: Jar Package Management, IDEA Performance, and Maven Dependency Optimization at Kuaishou

In Kuaishou's engineering architecture, every component, controller, and runner can be released as a JAR, leading to massive dependency chains that spread rapidly across multiple business lines, causing large SDKs and complex inter‑service dependencies.

Project Background : The traditional five‑layer structure (Component, Util, SDK, Runner, API) resulted in huge engineering packages and degraded efficiency and stability across business lines.

During the 2023 architecture governance, Java backend developers faced challenges due to the sheer volume of existing services and JARs. The article shares efficiency improvements and encountered problems.

Experience: IDEA Lag Issue

IDEA became unresponsive when indexing large codebases, especially on Intel‑based Macs. Two solutions were tried:

Online source browsing with OpenGrok, which indexed a million‑line project in about one minute but could not follow JAR dependencies.

Cloud‑based IDEA: a 12‑core, 24 GB container with a pre‑installed Java environment was provisioned. SSH keys were generated and added to the cloud host, Maven settings were copied, and locale was set to en_US.UTF-8 to avoid encoding issues.

Configuration steps included generating SSH keys ( ssh-keygen -t rsa -C "[email protected]" ), adding the public key to GitLab, and setting up Maven ( mkdir ~/.m2 && cp /usr/local/kuaishou-build-tools/src/main/resources/settings.xml ~/.m2 ).

Tooling: MavenHelper

MavenHelper, an IDEA plugin, visualizes Maven dependency trees and helps identify internal JARs that require explicit version declarations during dependency governance.

Custom Dependency Analysis Plugin

The team built a Maven plugin that collects each third‑party JAR's independent size and the total size of its transitive dependency tree. After Maven resolves the dependency graph, the plugin queries the collected data, sorts it, and outputs the top‑N heavy dependencies.

mvn clean -Denforcer.skip=true -DskipTests -Dmaven.test.skip=true -Dcheckstyle.skip com.kuaishou:operation-dependency-maven-plugin:RELEASE:ops-deps

The plugin leverages Maven's internal APIs, such as org.apache.maven.project.DefaultProjectDependenciesResolver#resolve and org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector#collectDependencies , to compute the impact of globally excluding a dependency.

NoClassDefFoundError Issue

During governance, many services encountered NoClassDefFoundError due to indirect dependencies not declared in the consuming module's POM. The root cause was a missing direct declaration of a transitive JAR, leading to runtime class loading failures.

Temporary fixes involved adding the missing dependency manually, but the long‑term solution was to enforce explicit dependency declarations and integrate a custom Maven class‑dependency detection plugin into the CI pipeline.

Static and Dynamic Analysis

The custom plugin performs static analysis by traversing direct class dependencies and dynamic analysis by scanning Spring beans for injection points, combining both to detect missing classes.

Overall, the governance effort highlighted the need for clear dependency declarations, automated analysis tools, and cloud‑based development environments to maintain backend stability and reduce build artifact sizes.

Summary

The article presents a comprehensive approach to backend engineering governance at Kuaishou, covering IDE performance tuning, cloud IDE adoption, Maven dependency analysis, handling runtime class‑loading errors, and building static‑dynamic analysis tools to improve codebase health.

JavaBackend Developmentdependency managementmavenArchitecture GovernanceIDEA
Kuaishou Tech
Written by

Kuaishou Tech

Official Kuaishou tech account, providing real-time updates on the latest Kuaishou technology practices.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.