I changed this like you told me. I think it now goes one step ahead, but doesn’t work completely
I create extensionContainer like
extensionContainer = new DefaultConvention(project.services.get(Instantiator)),
in a lazy getter getExtensions() in the Host class, because with default constructor of DefaultConvention I got an exception.
But now I have the following behavior:
As long as I do not define a dsl, which uses the foo,
e.g.
hosts {
testproject {
…
} }
everything works fine,
but as soon as I use this extended dsl, like hosts {
testhost {
…
foo { …
}
} }
I get an error Caused by: org.gradle.api.internal.MissingMethodException: Could not find method testhost() for arguments [pike_60hl1miv3hqfhsqsgf8g1l5der$_run_closure3_closure6@108f6716] on root project ‘testprojectVagrant’.
at org.gradle.api.internal.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:68)
at org.gradle.api.internal.AbstractDynamicObject.invokeMetho…
I don’t understand what is going on in this case Can you please give me a hint?
Hey Markus, it is a bit trickier than I thought, as the objects in a namedobject container are not automatically extensionaware (which is private gradle API at the moment).
I created a simple working example (without capsuling stuff in plugins but in a plain build.gradle file) for your usecase (using some private api (not avoidable atm if you really need that) at https://gist.github.com/breskeby/519cee19d3cb6127fff6
hope that helps. if you have more questions about that, just ask