
Tool Chain
How ApiHug Stub gradle task work
May be a bit out of date ⚠️⚠️⚠️
Stub used to generate the template implement code, and 3rd party dependencies integrated.
Please refer to apihug-full-demo demo-user/build.gradle:
plugins {
id "java"
alias(libs.plugins.springBoot)
alias(libs.plugins.springDependency)
alias(libs.plugins.hopeStub)
alias(libs.plugins.liquibase)
}
hopeStub {
debug = false
}
Meta information apihug-full-demo demo-user/hope-stub.json:
{
"packageName": "com.apihug.demo.user",
"name": "demo-user",
"domain": "user",
"proto": {
"artifact": {
"groupId": "com.apihug",
"artifactId": "demo-user-proto",
"version": "0.1.1-SNAPSHOT"
},
"module": "demo-user-proto",
"domain": "user",
"applied": true
},
"dependencies": [
]
}
hopeStub Configuration:
| Name | Description | Type | (Default) | Remarks |
|---|---|---|---|---|
| debug | Plugin Debugging | boolean | false | Exit after configuration check, without completing any code generation |
| verbose | Enable Execution Log | boolean | false | Open full log for debugging when issues arise |
| generatedVersion | Include Plugin Version | boolean | false | Whether the @Generated annotation in the generated code includes the plugin version |
| generatedTime | Include Generation Timestamp | boolean | false | Whether the @Generated annotation in the generated code includes the generation timestamp |
| pluginMainVersion | Plugin Auxiliary Version | String | The version dependency of the wire plugin at runtime, do not set unless necessary. Apihug’s overall package is released with BOM, and this version should not be manually set | |
| pluginMainClass | Plugin Auxiliary Main Entry | String | Do not set unless the plugin is extended | |
| enableFrontVue | Generate Front Vue Scaffolding | boolean | false | Experimental stage |
| adminStub | Generate Admin Management Code | boolean | false | Not enabled |
Meta configuration resources\hope-stub.json:
proto configuration, define dependencies for a single self-service protocol.dependencies, understand as dependencies on other microservices, which can be multiple.build.gradle, this section is not necessary. Incorrect configurations can lead to compilation errors and may cause runtime errors! ⚠️⚠️⚠️
proto package can be controlled through standard Gradle dependencies.resources\hope-stub.json file, and the plugin will handle it for you.| Name | Description | Type | (Default) | Remarks |
|---|---|---|---|---|
| packageName | Package Name | String | Required | Project package name, must conform to Java package naming conventions, cannot contain reserved keywords: wire, stub |
| name | Project Name | String | Required | Project identifier, must conform to artifact ID, lowercase, Chinese characters, e.g., user-info, corresponds to the application of the proto project |
| domain | Domain | String | Required | The domain it belongs to |
| proto.artifact.groupId | Self-service Proto Group ID | String | Optional | Self-service, dependency package group ID |
| proto.artifact.artifactId | Self-service Proto Artifact ID | String | Optional | Self-service, dependency package artifact ID |
| proto.artifact.version | Self-service Proto Version | String | Optional | Self-service, dependency package version |
| proto.module | Self-service Proto Module | String | Required | Used for service locator at runtime to locate, if not set, proto.artifact.artifactId is used instead |
| proto.domain | Self-service Proto Domain | String | Optional | If not set, it is the same as the main project domain |
| proto.applied | Self-service Proto Included | boolean | Required | Whether it has been included, if already included in gradle > dependencies, the plugin will not include the lib again |
| dependencies.artifact.groupId | Third-party Service Proto Group ID | String | Optional | Third-party service, dependency package group ID |
| dependencies.artifact.artifactId | Third-party Service Proto Artifact ID | String | Optional | Third-party service, dependency package artifact ID |
| dependencies.artifact.version | Third-party Service Proto Version | String | Optional | Third-party service, dependency package version |
| dependencies.module | Third-party Service Proto Module | String | Required | Third-party service, module name, if not set, it should be consistent with artifact.artifactId |
| dependencies.domain | Third-party Service Proto Domain | String | Required | Third-party service, domain |
| dependencies.applied | Third-party Service Proto Included | boolean | false | Whether it has been included, if already included in gradle > dependencies, the plugin will not include the lib again |
Every Auto generated project include a detail README example: README, include detail instruction how to use it.
NOT like Wire which integrate with gradle’s default compile task, stub must run manually as you manually trigger it:
sh gradlew {YOUR_MODULE}:clean stub build -x test -x stubTest