Extension reference

Every property of the klok { } extension can be set in build.gradle, as a Gradle property (-P or gradle.properties) or as an environment variable. The order is the build script, then the environment variable, then the Gradle property, then the default (KlokExtension.resolveConvention). The other settings of the plugin (klokAgents*, klokGitAuthToken, klokKnowledge and the like) are read the other way round: the Gradle property first, then the environment variable.

Property Gradle property / environment variable Default Used for
tenant klokTenant / KLOK_TENANT default-tenant group id, repository names, documentation facts, the tenant catalog (default-tenant means none; then CI_PROJECT_ROOT_NAMESPACE, else the root group of CI_PROJECT_PATH). The documentation payload and klokTopics prefer klok.tenant in application.properties over the placeholder (Broker topics); klokSolutionCheck takes CI_PROJECT_ROOT_NAMESPACE first, then klok.tenant (Solution ids)
domain klokDomain / KLOK_DOMAIN default-domain documentation facts. default-domain means none: the documentation payload then states klok.domain from application.properties; klokTopics always takes klok.domain first and uses this value only when that key is missing
projectType klokProjectType / KLOK_PROJECT_TYPE APPLICATION dependency bundle, group id, repository name segment (ProjectType of klok-common); INTEGRATION and APPLICATION are versioned by their commit time and built reproducibly, DATAMODEL and OTHER by their build time
projectVisibility klokProjectVisibility / KLOK_PROJECT_VISIBILITY TENANT PUBLIC, TENANT, DOMAIN, SYSTEM: the repository and Maven Central publishing (PUBLIC). Who reads the project's documentation on docs.klok.dev is not set here but in its documentation project's klok-documentation-settings.json
projectDesc klokProjectDesc / KLOK_PROJECT_DESC My Klok Project Description POM and documentation
majorVersion, minorVersion, patchVersion klokMajorVersion / KLOK_MAJOR_VERSION ... 0, 1, 0 version
disableTimestampVersionMetadata klokDisableTimestampVersionMetadata / KLOK_DISABLE_TIMESTAMP_VERSION_METADATA false local builds only; releases always carry the timestamp
disableJavaDocGeneration klokDisableJavaDocGeneration / KLOK_DISABLE_JAVADOC_GENERATION false skip the javadoc jar
baseNamespace klokBaseNamespace / KLOK_BASE_NAMESPACE the project's group read by nothing. A build that sets no group gets dev.klok.<tenant>.<projectType in lower case>
gitAuthToken unset read by nothing. The plugin's GitLab requests take the Gradle property klokGitAuthToken, else the environment variable GITLAB_TOKEN, and CI_JOB_TOKEN in CI (Repositories, Catalog update)
repoWebUrl klokRepoWebUrl / KLOK_REPO_WEB_URL https://example.com/klok POM and release links
maintainer, maintainerEmail klokMaintainer / KLOK_MAINTAINER, klokMaintainerEmail / KLOK_MAINTAINER_EMAIL placeholders POM
projectLicenseName, projectLicenseUrl klokProjectLicenseName / ..., klokProjectLicenseUrl / ... Apache 2.0 POM (mandatory for Maven Central)
scmConnection, scmDeveloperConnection derived from the repository URL POM
brokerUrl klokBrokerUrl / KLOK_BROKER_SERVICE_URL pulsar+ssl://broker.ipaas.se:6651 the broker publishKlokDocs sends the documentation payload to (Documentation tasks)
projectDisplayName klokProjectDisplayName / KLOK_PROJECT_DISPLAY_NAME the project name POM name

In CI the environment variables are exported by the build templates (KLOK_TENANT from the root namespace) and by the Vault login script, so a project normally sets only projectType, projectVisibility, projectDesc and the three version numbers.

Repositories

The plugin adds no repository by itself. It offers the klokRespositories { } block (the spelling is historical) inside repositories { }, and the integration template calls it:

repositories {
    klokRespositories {
        mavenLocal()
        klokDefaultRepositories()
    }
}
Method Repositories
klokDefaultRepositories() Maven Central, Maven local, the tenant's group registry (klokTenantGitlabRepository()) and the platform group registry klok; no tenant registry when no tenant is known, and none for tenant klok, whose registry is the platform's
klokTenantGitlabRepository() the group registry of the project's tenant (below); nothing, with a warning, when no tenant is known
klokSpecificTenantGitlabRepository(tenant) the group registry of another tenant (shared datamodels)
klokGitlabRepository() the platform group registry klok only

A group registry is <klokGitlabBaseUrl>/api/v4/groups/<group>/-/packages/maven, where klokGitlabBaseUrl is the Gradle property or KLOK_GITLAB_BASE_URL, with the default https://git.klok.dev. The tenant is resolved as everywhere else in the plugin: klok { tenant } (which reads klokTenant and KLOK_TENANT), else GitLab's CI_PROJECT_ROOT_NAMESPACE, else the root group of CI_PROJECT_PATH. That is what lets a generated datamodel project, which has no gradle.properties, find its own tenant's packages: the build templates export KLOK_TENANT. It is resolved when klokDefaultRepositories() is called, so a tenant set in klok { } further down the build script is not seen there; the templates set it through the environment.

Authentication, per registry:

  • in CI, the JOB-TOKEN header with CI_JOB_TOKEN;
  • elsewhere, with a deploy token when both klokGitlabDeployUser (or KLOK_GITLAB_DEPLOY_USER) and klokGitlabDeployToken (or KLOK_GITLAB_DEPLOY_TOKEN) are set;
  • otherwise the Private-Token header with the Gradle property klokGitAuthToken, else GITLAB_TOKEN. A developer puts klokGitAuthToken=<personal access token with read_api> in ~/.gradle/gradle.properties.

Reading a package through the group endpoint requires the package's project to allow job tokens from the reader's group, which the framework and datamodel projects do for the klok group.

Dependency bundles

klokIntegrationImpl, klokApplicationImpl and klokDatamodelImpl are bundles in klok-libs.versions.toml. The plugin applies the bundle for the project type to implementation, enforces the quarkus.bom and quarkus.camel.bom platforms and adds the sources jars of the framework libraries so IDEs show the framework code. A project adds its own dependencies next to that as usual.

klokLibsUpdate { }

The block configures updateKlokLibsToml (Catalog update); a project normally sets nothing here.

Property Default Used for
url the raw file API of klok-libs.versions.toml on the platform catalog's main where the platform catalog is fetched from
targetPath gradle/klok-libs.versions.toml the project's platform catalog copy
tenantUrl the raw file API of <tenant>-libs.versions.toml on the tenant catalog's main, from the resolved tenant and klokGitlabBaseUrl / KLOK_GITLAB_BASE_URL; absent for tenant klok and for no tenant where the tenant catalog is fetched from
tenantTargetPath gradle/tenant-libs.versions.toml the project's tenant catalog copy; fixed because from files(...) in settings.gradle is a literal path

Settings plugin

KlokSettingsPlugin (dev.klok.integration.settings) is published but is a placeholder: applying it configures nothing. The two catalogs are declared in settings.gradle (versionCatalogs { klokLibs { from files('gradle/klok-libs.versions.toml') }; tenantLibs { from files('gradle/tenant-libs.versions.toml') } }), as every project generated from the templates does; both files are committed, the tenant one empty until the first refresh.