How to solve multiple uses the custom plugins with different extension configuration

plugins

(Alex V. Timochkin) #1

I have custom plugin apply, for example:

apply plugin: ‘myplugin’
myExt {
appModule = project.appModule
appName = project.appName
}

Model as a custom_plugin_example Run command: gradle build myTask -PappModule=module1 -PappName=app1, It works fine, but i need to configure more then one configuration in my build project, something like this:

def appModuleList = [‘module1’, ‘module2’, ‘module3’]

If i use loop:

appModuleList.each { module ->
apply plugin: ‘myplugin’
myExt {
appModule = module
appName = project.appName
}
}

result get only for the last element of appModuleList

How do i use my plugin with different configuration in project many times?