Package io.asyncapi.generator
Class GenerateAsyncApiTask
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
io.asyncapi.generator.GenerateAsyncApiTask
- All Implemented Interfaces:
Comparable<org.gradle.api.Task>,org.gradle.api.internal.DynamicObjectAware,org.gradle.api.internal.TaskInternal,org.gradle.api.Named,org.gradle.api.plugins.ExtensionAware,org.gradle.api.Task,org.gradle.util.Configurable<org.gradle.api.Task>
@CacheableTask
public abstract class GenerateAsyncApiTask
extends org.gradle.api.DefaultTask
Gradle task that parses an AsyncAPI 3.x specification and generates
Spring Kafka consumer and producer Java source files.
This task is incremental: it is UP-TO-DATE when neither the spec file nor any input properties have changed since the last build.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Named
org.gradle.api.Named.Namer -
Field Summary
Fields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerate()Executes code generation: parses the AsyncAPI spec and writes Java sources.abstract org.gradle.api.provider.Property<String>Base Java package for all generated types.abstract org.gradle.api.provider.Property<Boolean>Whether to generate aAsyncApiKafkaConfigSpring configuration bean.abstract org.gradle.api.file.RegularFilePropertyThe AsyncAPI spec file to parse (YAML or JSON).abstract org.gradle.api.file.DirectoryPropertyDirectory where generated Java source files will be written.abstract org.gradle.api.provider.Property<Boolean>Whether to annotate generated model classes with Lombok annotations.Methods inherited from class org.gradle.api.DefaultTask
compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTask
acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.Task
doNotTrackState, notCompatibleWithConfigurationCache
-
Constructor Details
-
GenerateAsyncApiTask
public GenerateAsyncApiTask()
-
-
Method Details
-
getInputFile
@InputFile @PathSensitive(RELATIVE) public abstract org.gradle.api.file.RegularFileProperty getInputFile()The AsyncAPI spec file to parse (YAML or JSON).- Returns:
- file property for the spec
-
getOutputDir
@OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getOutputDir()Directory where generated Java source files will be written. Defaults tobuild/generated/sources/asyncapi/main/java.- Returns:
- directory property for generated sources
-
getBasePackage
Base Java package for all generated types.- Returns:
- string property for the base package
-
getGenerateKafkaConfig
Whether to generate aAsyncApiKafkaConfigSpring configuration bean.- Returns:
- boolean property
-
getUseLombok
Whether to annotate generated model classes with Lombok annotations.- Returns:
- boolean property
-
generate
Executes code generation: parses the AsyncAPI spec and writes Java sources.- Throws:
IOException- if the spec cannot be read or sources cannot be written
-