Tool Chain

Gradle Stub

Use the ApiHug stub task to generate application scaffolding from a prepared proto module.

stub is the application-side generation task in the ApiHug Gradle toolchain. (deprecated, move to wire already)

What It Is

It consumes the proto module and generates the application scaffolding that your handwritten code builds on.

Why It Matters

stub is where contract-first design turns into runnable application structure. It is also where generated and handwritten boundaries become visible.

How It Fits

Basic plugin setup

Groovy
plugins {
  id "java"
  alias(libs.plugins.springBoot)
  alias(libs.plugins.springDependency)
  alias(libs.plugins.hopeStub)
  alias(libs.plugins.liquibase)
}

hopeStub {
  debug = false
}

Typical hopeStub options

OptionPurpose
debugstop after configuration checks
verboseprint detailed execution logs
generatedVersionadd plugin version to generated metadata
generatedTimeadd generation time to generated metadata
enableFrontVuegenerate experimental frontend scaffolding

Key hope-stub.json fields

FieldPurpose
packageNameJava package root for the app module
nameapplication module name
domainmain business domain
proto.artifact.*coordinates for the self-service proto jar
proto.moduleruntime module name for the local contract
proto.domaindomain used by the local contract
proto.appliedwhether the dependency is already present
dependencies.*optional third-party proto dependencies

Keep one dependency strategy. Do not mix manual Gradle dependency management and conflicting hope-stub.json declarations unless you have a specific reason to do so.

Run It

Unlike wire, stub is usually triggered explicitly:

Terminal
gradlew {YOUR_MODULE}:clean stub build -x test -x stubTest

Next Step

After stub runs, implement business logic only in the handwritten layers and review the result with Implementation Review.

Copyright © 2026 ApiHug·AI-native Enterprise Architecture Factory