This is a wrapper over the Go CD newest JSON plugin API hiding all the communication details, letting you to focus only on writing the task logic.
Add the dependency to your project.
<dependency>
<groupId>io.jmnarloch</groupId>
<artifactId>gocd-task-plugin-api</artifactId>
<version>1.0.0</version>
</dependency>
Create a class that will extend the AbstractDispatchingTask
and provide the ApiRequestDispatcher
.
@Extension
public class GradleTask extends AbstractDispatchingTask {
@Override
protected ApiRequestDispatcher buildDispatcher() {
return ApiRequestDispatcherBuilder.dispatch()
.toConfiguration(new AnnotatedEnumConfigurationProvider<>(GradleTaskConfig.class))
.toValidator(new GradleTaskValidator())
.toView(new GradleTaskView())
.toExecutor(new GradleTaskExecutor())
.build();
}
}
Apache 2.0