I have recently written a plugin for gradle that allows me to generate java source from wsdl using apache cxf. This plugin uses the latest release of apache cxf to do the work.
Is there some way I could allow my users to dynamically choose which version of cxf that will be used, or do I have to create a separate version for each specific cxf-release?
The cxf-libs are compile-time dependencies to the plugin.
You can just set a default version as a dependency of your plugin and then allow users to define their own dependency via the buildscript classpath. Note that if they want a version lower than what your plugin calls for, they will need to force their version. For instance:
The alternative is more work and is what is used in the JRuby Base and Asciidoctor plugins.
Allow the user to specify the version you want in an extension i.e.
jruby {
defaultVersion = '1.7.15'
}
Internaly the plugin uses a ‘project.afterEvaluate’ closure to check the version and add it a configuration. For instance in one of the aforementioned plugins the equivalent code could be something like