AntBuilder pseudo-targets


/ Published in: Groovy
Save to your folder(s)

Way to make ant-like pseudo-targets in groovy AntBuilder


Copy this code and paste it in your HTML
  1. DEFAULT = 'jar'
  2. DEST = 'target'
  3. JAR = "$DEST/myapp.jar"
  4. SRC = 'src'
  5.  
  6. ant = new groovy.util.AntBuilder()
  7. ant.taskdef(name: 'groovyc', classname: 'org.codehaus.groovy.ant.Groovyc')
  8. compile = {
  9. println '\ncompile:'
  10. ant.mkdir(dir: DEST)
  11. ant.groovyc(destdir: DEST, srcdir: SRC, includes: '**/*.groovy')
  12. }
  13. jar = {
  14. compile()
  15. println '\njar:'
  16. ant.jar(destfile: JAR, basedir: DEST, includes: '**/*.class')
  17. }
  18.  
  19. if (args) for (t in args) this[t]() else this[DEFAULT]()

URL: groovy_ant_builder_target

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.