Java code generators for Kentico Cloud.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Add/update issue, PR templates, code of conduct, contributing guide Sep 6, 2018
.idea Updating sdk version. [ci-skip] Sep 30, 2017
.travis #8 Publishing to maven central Sep 17, 2017
cloud-generators-gradle Updating sdk version. [ci-skip] Sep 30, 2017
gradle/wrapper #2 Completed gradle plugin Sep 17, 2017
.gitignore #1 Implemented cloud-generator-core to be used by exe/gradle/maven Sep 16, 2017
.travis.yml Add/update issue, PR templates, code of conduct, contributing guide Sep 6, 2018 Add/update issue, PR templates, code of conduct, contributing guide Sep 6, 2018
LICENSE Initial commit Sep 11, 2017
build.gradle #1 Implemented cloud-generator-core to be used by exe/gradle/maven Sep 16, 2017
cloud-generators-java.iml #1 Implemented cloud-generator-core to be used by exe/gradle/maven Sep 16, 2017
gradlew #1 Implemented cloud-generator-core to be used by exe/gradle/maven Sep 16, 2017
secrets.tar.enc #8 Publishing to maven central Sep 17, 2017
settings.gradle #2 Initial work on gradle plugin. Sep 16, 2017

Kentico Cloud model generator utility for Java

Build Status License: MIT SonarQube

This utility generates strongly-typed models based on Content Types in a Kentico Cloud project. The models are supposed to be used together with the Kentico Cloud Delivery SDK for Java. Please read the documentation to see all benefits of this approach.

How to use


Apply the gradle plugin to your build file.

plugins {
  id "com.kenticocloud.generator" version "1.1"

If you are not on Gradle 2.1 or later, apply it via Maven central.

buildscript {
	repositories {
	dependencies {

apply plugin: 'com.kenticocloud.generator'

Configure the plugin.

apply plugin: 'java'

kenticoModel {
	projectId = '975bf280-fd91-488c-994c-2f04416e5ee3'
	packageName = 'com.dancinggoat.models'
	outputDir = file('generated-sources')

dependencies {

To generate sources, run the 'generateModels' task.

./gradlew generateModels

If you have the 'java' plugin applied to your project, the plugin will automatically register your outputDir as a srcDir with it.

The plugin does not however automatically attach itself to the build task graph, so if you desire to add it, that has to be done manually. Note however, it may not be desirable to do so, as the plugin makes a call to the Kentico API which may increase build time. It is recommended you check your generated sources in.

If you are an IntelliJ user, you can hint to IntelliJ that a warning should be provided when editing the generated sources by adding the following:

apply plugin: 'idea'

idea {
	module {
		// Marks the already(!) added srcDir as "generated"
		generatedSourceDirs += file('generated-sources')


  • projectId - required - a GUID that can be found in Kentico Cloud -> API keys -> Project ID
  • packageName - required - a name of the Java package to put your generated sources into
  • outputDir - required - a File object instance referencing an output folder path

Example output

package com.dancinggoat.models;

import java.lang.String;
import java.time.ZonedDateTime;
import java.util.List;

 * This code was generated by a <a href="">cloud-generators-java tool</a>
 * Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
 * For further modifications of the class, create a separate file and extend this class.
public class Article {
  List<Taxonomy> personas;

  String title;

  List<Asset> teaserImage;

  ZonedDateTime postDate;

  String summary;

  String bodyCopy;

  List<ContentItem> relatedArticles;

  String metaKeywords;

  String metaDescription;
  System system;

  public List<Taxonomy> getPersonas() {
    return personas;

  public void setPersonas(List<Taxonomy> personas) {
    this.personas = personas;

  public String getTitle() {
    return title;

  public void setTitle(String title) {
    this.title = title;

  public List<Asset> getTeaserImage() {
    return teaserImage;

  public void setTeaserImage(List<Asset> teaserImage) {
    this.teaserImage = teaserImage;

  public ZonedDateTime getPostDate() {
    return postDate;

  public void setPostDate(ZonedDateTime postDate) {
    this.postDate = postDate;

  public String getSummary() {
    return summary;

  public void setSummary(String summary) {
    this.summary = summary;

  public String getBodyCopy() {
    return bodyCopy;

  public void setBodyCopy(String bodyCopy) {
    this.bodyCopy = bodyCopy;

  public List<ContentItem> getRelatedArticles() {
    return relatedArticles;

  public void setRelatedArticles(List<ContentItem> relatedArticles) {
    this.relatedArticles = relatedArticles;

  public String getMetaKeywords() {
    return metaKeywords;

  public void setMetaKeywords(String metaKeywords) {
    this.metaKeywords = metaKeywords;

  public String getMetaDescription() {
    return metaDescription;

  public void setMetaDescription(String metaDescription) {
    this.metaDescription = metaDescription;
  public System getSystem() {
    return system;
  public void setSystem(System system) {
    this.system = system;

Feedback & Contributing

Check out the contributing page to see the best places to file issues, start discussions and begin contributing.

Further information

For more developer resources, visit the Kentico Cloud Developer Hub at

Building the sources


Required: Java 8 SDK (Oracle & OpenJDK both tested and supported)

Ensure your JAVA_HOME environment is set. Then build the project via the provided Gradle wrapper.

./gradlew clean build

Optional: JetBrains IntelliJ Idea project files are included. Open up the project and Import the Gradle project to sync up dependencies.

  • Note: The Gradle Test Kit in the cloud-generators-gradle module requires some extra steps to ensure it can access the classpath of the plugin, which are handled in the gradle build. When running the unit test from inside IntelliJ, you may need to run the gradle build prior to ensure the latest build output is used if you are changing the main sources.