How to create custom tasks to be executed in custom plugin

I am trying to create a custom plugin that will execute a custom task based on a custom extension. The custom task is created by the plugin, but it is never executed.

Here is my build.gradle:

apply plugin: FooPlugin

def info1 = "loc1"
def info2 = "loc2"

foos {
    fee {
        info = info1
    }
    fie {
        info = info2
    }
}

Here is my plugin:

class FooPlugin implements Plugin<Project> {
    void apply(Project project) {
        def foos = project.container(Foo)
        project.extensions.foos = foos
        foos.all{foo->
            project.tasks.create(foo.name, FooTask.class)
            println project.tasks.getByName(foo.name)
        }
    }
}

The output of this println is:

task ':fee'
task ':fie'

Here is my task:

 class FooTask extends DefaultTask{
    @TaskAction
    def doStuff() {
        println "here"
        println project.extensions
    }
 }

Two tasks of the type FooTask are created however here and the project extensions are never printed

Here is my extension:

 class Foo{
    final String name

    Foo(String name) {
        this.name = name
    }

    @Input
    Collection<String> options = []

    @Input
    boolean recursive = true

    @Input
    File source

    @OutputDirectory
    File target
}