Plugin domain objects nested in named domain object container

Hi,

I’m trying to put a domain object inside a named domain object in a container, but does not really work. Example plugin:

class DevelopmentEnvironmentInstallation {
    String hest
}

class Product {
    final String name
    DevelopmentEnvironmentInstallation developmentEnvironmentInstallation

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

    void developmentEnvironmentInstallation(Action<? super DevelopmentEnvironmentInstallation> action) {
        action.execute(developmentEnvironmentInstallation)
    }
}

class PlatformPlugin implements Plugin<Project> {
    void apply(Project project) {
        def products = project.container(Product)
        project.extensions.products = products

        products.all {
            developmentEnvironmentInstallation = project.getObjects().newInstance(DevelopmentEnvironmentInstallation)
        }
    }
}

apply plugin: PlatformPlugin


products {

    prod1 {

    }
    prod2 {
        developmentEnvironmentInstallation {
            hest = "pony"
        }
    }
}

task listProducts {
    doLast {
        products.each { product -> println "$product.name"}
    }
}

The “hest” field seems to catch scope from Product object and not DevelopmentEnvironmentInstallation object as intended. Any suggestions how to do this correctly? The error I get is

Could not find method hest() for arguments [pony] on object of type Product.

When I just nest domain objects, it works fine, like this:

class DevelopmentEnvironmentInstallation {
    String hest
}

class Product {
    DevelopmentEnvironmentInstallation developmentEnvironmentInstallation

    void developmentEnvironmentInstallation(Action<? super DevelopmentEnvironmentInstallation> action) {
        action.execute(developmentEnvironmentInstallation)
    }
}

class PlatformPlugin implements Plugin<Project> {
    void apply(Project project) {

        project.extensions.product = project.getObjects().newInstance(Product)
        project.product.developmentEnvironmentInstallation = project.getObjects().newInstance(DevelopmentEnvironmentInstallation)
    }
}

apply plugin: PlatformPlugin


product {
    developmentEnvironmentInstallation {
        hest = "pony"
    }
}