Description
I would like to enhance how users defines plugin properties. First, let's refresh our minds on current behavior.
If a user needs a specific plugins he will put the following in his module.ivy (or in module.ant) :
<ea:plugin module="scm-svn" revision="0.1" />
Then for some plugins users will need to define mandatory properties. In my previous example scm-svn plugin requires "scm.connection.baseurl" property to be set.
So user will do:
<ea:plugin module="scm-svn" revision="0.1"> <property name="scm.connection.baseurl" value="/path/to/mySVN"/> </ea:plugin>
Functional part
To enhance this i suggest to consider properties as attributes of <ea:plugin>.
<ea:plugin module="scm-svn" revision="0.1" scm.connection.baseurl="/path/to/mySVN" />
Using "." in xml attributes isn't sexy at all, so we can use dash instead.
<ea:plugin module="scm-svn" revision="0.1" scm-connection-baseurl="/path/to/mySVN" />
Technical part
I recently discovered on ant-dev ML that ant provides an interface named "DynamicAttribute" allowing Task writers to handle dynamic arguments.
Here is a snipet of how we could implement our enhancement on easyant import task :
public void setDynamicAttribute(String attributeName, String value) throws BuildException { String propertyName = attributeName.replaceAll("-", "."); PropertyTask property = new PropertyTask(); property.setName(propertyName); property.setValue(value); initTask(property).execute(); }
That's all !