Custom plug in to execute Java tasks

Hi All, Thanks for the excellent guidance I had received for my earlier problems .

I am trying to use a custom plugin.

I have a project with a build.gradle below

apply plugin: ‘greeting’ apply plugin: ‘java’ dependencies {

compile project(’:my-lib’) } schemaObjectName {

className = “” } compileJava.doLast {

tasks.createBinding.execute() }

This is my plugin where I create dependencies and tasks to the project

class GreetingPlugin implements Plugin {

void apply(Project target) {

target.task(‘helloInsideGreeting’, type: GreetingTask)

println ’ creating new dependency ’





target.extensions.create(“schemaObjectName”, SchemaObjectName)

target.task(‘createBinding’, type:JavaExec) << {

classpath configurations.bindGen

classpath sourceSets.main.output.classesDir

main = “org.jibx.binding.generator.BindGen”

args “-w” , “-o” , “-t”, “${projectDir}/src/main/reosurces/bindgen”,



} }

class SchemaObjectName {

String className

I tested adding simple tasks dynamically to the project using the custom plug in and worked ( I also tried the greeting sample in the distribution ). I am trying to add a task of type JavaExec. When I run the task createBinding , I get the below exception

Caused by: java.lang.IllegalStateException: No main class specified


Main class is already specified in the task. Is there any different to be specified in the custom plugin for type Java Exec ?

please ignore the above question . The task was configured incorrectly .