Methods in extensions -> custom plugin

(Zbyszek Sokolowski) #1

How can I use method in extension in custom plugin, I would like to have the same functionality as in sonar plugin:

void withProjectProperties(Closure block) {
        propertyProcessors << block

I was trying something like this but it doesn’t work:

Map <String, String> sonarProps = project.sonarutils.cpp.sonarProperties
    for (Map.Entry<String, String>
      project.sonar.project.withProjectProperties { props ->
        props[entry.key] = entry.value

(Peter Niederwieser) #2

There is nothing special about it - you just grab the extension object, and call the method. There must be something else wrong with your code.

(Zbyszek Sokolowski) #3

please do better examples on extensions, but it worked with your tip