Hi,
I got it basically working with your hint. I've already noticed that this is not (yet) public api. FYI: Unfortunately, If I mark "ExampleModel" as an input property in my task i got an error:
---------------
java.io.NotSerializableException: org.gradle.api.internal.AsmBackedClassGenerator$MixInDynamicObject
---------------
to bad. That's the price on skating on thin ice, I think.

regards,
René




Am 11.05.11 16:48, schrieb Szczepan Faber:
Hey,

Bear in mind that this is not fully public api :)

def ExampleModel model = services.get(ClassGenerator).newInstance(ExampleModel)

Then you should be able to put convention properties, e.g:

model.conventionMapping.someProperty = { ... }

Cheers,
Szczepan

On Wed, May 11, 2011 at 10:31 AM, Rene Groeschke <[email protected] <mailto:[email protected]>> wrote:


    Hi there,
    I have another question about convention mapping objects.
    I have a task that has a custom class as model:

    -------------
    class ExampleTask implements ConventionTask{
       def ExampleModel model = new ExampleModel();
    }

    class ExampleModel {
       String title
    }
    -------------

    now I would like to add a property called exampleTitle as a
    convention-property to my project.

    In my ExamplePlugin I have the following line:
    -------------
     siteTask.conventionMapping.model.title = {
    pluginConvention.exampleTitle }
    -------------

    when running my tests now, I get the following error:
    > groovy.lang.MissingPropertyException: No such property: model
    for class: org.gradle.api.internal.ConventionAwareHelper


    Anybody an idea how to wire the title attribute to the
    "exampleTitle" attribute of my pluginConvention? I'm not sure if
    this is a gradle question or just the result of my lacking groovy
    knowledge.

    regards,
    René

-- -----------------------
    regards René

    rene groeschke
    http://www.breskeby.com
    @breskeby


    ---------------------------------------------------------------------
    To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
-----------------------
regards René

rene groeschke
http://www.breskeby.com
@breskeby

Reply via email to