Tool Chain/Stub
Tool Chain
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)
It consumes the proto module and generates the application scaffolding that your handwritten code builds on.
stub is where contract-first design turns into runnable application structure. It is also where generated and handwritten boundaries become visible.
plugins {
id "java"
alias(libs.plugins.springBoot)
alias(libs.plugins.springDependency)
alias(libs.plugins.hopeStub)
alias(libs.plugins.liquibase)
}
hopeStub {
debug = false
}
hopeStub options| Option | Purpose |
|---|---|
debug | stop after configuration checks |
verbose | print detailed execution logs |
generatedVersion | add plugin version to generated metadata |
generatedTime | add generation time to generated metadata |
enableFrontVue | generate experimental frontend scaffolding |
hope-stub.json fields| Field | Purpose |
|---|---|
packageName | Java package root for the app module |
name | application module name |
domain | main business domain |
proto.artifact.* | coordinates for the self-service proto jar |
proto.module | runtime module name for the local contract |
proto.domain | domain used by the local contract |
proto.applied | whether 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.
Unlike wire, stub is usually triggered explicitly:
gradlew {YOUR_MODULE}:clean stub build -x test -x stubTest
After stub runs, implement business logic only in the handwritten layers and review the result with Implementation Review.