Hi everyone,
I have started a project to create a Groovy API for ShrinkWrap and ShrinkWrap descriptors: https://github.com/shrinkwrap/shrinkwrap-groovy
It looks like this:
class ExampleDeploy {
def static ear = ShrinkWrapGroovy.createClosureForArchive(EnterpriseArchive.class)
def static war = ShrinkWrapGroovy.createClosureForArchive(WebArchive.class)
def static jar = ShrinkWrapGroovy.createClosureForArchive(JavaArchive.class)
def static beans = ShrinkWrapGroovy.createClosureForDescriptor(BeansDescriptor.class)
def static webXml = ShrinkWrapGroovy.createClosureForDescriptor(WebAppDescriptor.class)
def static application = ShrinkWrapGroovy.createClosureForDescriptor(ApplicationDescriptor.class)
def otherClasses = {
classes Double.class, Float.class
}
def webAppDesc = webXml {
version "3.0"
sessionConfig {
sessionTimeout 30
}
}
def warDesc = war {
asLibrary jar ('myjar.jar') {
classes String.class, Integer.class
}
include otherClasses
asResource beans {
alternatives {
clazz StringBuilder.class.name
}
}, "META-INF/beans.xml"
asWebInfResource webAppDesc, "web.xml"
}
def earDesc = ear {
asModule warDesc
setApplicationXML application {
module {
web {
webUri "aUri"
contextRoot "aContextRoot"
}
}
}
}
def build() {
earDesc.build()
}
}
I would if you guys could have a look at it and give some feedback about it, whether you find it useful, potential use cases and the like. Any comments are welcome!
Carlos.