On 08/22/2011 04:43 AM, Vincent Massol wrote:
Hi devs,
I'd like to propose adding the Ivy JAR to our Platform/XE distributions.
The reason is simple: it makes it possible to use the Groovy @Grab directive which makes
it real easy to extend XWiki using Groovy script.
Several advantages:
- not having to manually hunt for transitive dependencies
- not needing to stop/restart XWiki (since this is what you need to do if your groovy
script needs to use some third party jars).
Here's a good usage example:
-0.
It is a very cool feature, but I don't think it's something useful for a
majority of users. It's something very useful in a development wiki like
we have on
xwiki.org, but it adds almost 1M extra size, and increases
the classpath and the permgen requirements.
I think the extension manager would make it easy to install Ivy when needed.
{{cache}}
{{groovy}}
@Grab(group='org.codehaus.groovy.modules.http-builder',
module='http-builder', version='0.5.1')
import groovyx.net.http.RESTClient
github = new RESTClient( 'http://github.com/api/v2/json/' )
println "|=Project|=Description|=Use Wiki?|=Use Issues?"
def response = github.get( path : 'repos/show/xwiki' )
response.data.repositories.each() { repo ->
println
"|[[${repo.name}>>http://github.com/xwiki/${repo.name}]]|${repo.description}|${repo.has_wiki}|${repo.has_issues}"
}
{{/groovy}}
{{/cache}}
If you try to do this without the grab directive you'll find yourself hunting down
more than 30 jars which you'll need to put in your WEB-INF/lib directory, whereas here
it's a single line directive. It's really powerful.
Here's my +1 to make it easy for users to use Groovy scripts.
Thanks
-Vincent
--
Sergiu Dumitriu
http://purl.org/net/sergiu/