Back to Library

Bootstrapping

/*
/ ensure ant.jar and antlauncher.jar 
/ are on the class path and run as a standard groovy script
*/
import groovy.xml.NamespaceBuilder

class build {
	def ant = new AntBuilder()
	
	public static void main(args){
		def  b = new build()
		
	}
}

Resolving Dependencies with Ivy

// add ivy to the list of tools for gant
includeTool << gant.tools.Ivy
 
target('retrieveDependencies':'Install dependencies') {
  def lib = new File("lib")
  lib.mkdir()
  println "saving files to $lib.absolutePath"
 
  // we use the default properites but you can define your own  
  //ivy.settings(file:"${System.getProperty('user.home')}/.ivy2/ivysettings-newtec.xml")
 
 ivy.resolve(file:'ivy.xml') // the file where the dependencies are stored
 ivy.retrieve(ivypattern:"$lib.absolutePath/[artifact].[ext]") // copy locally
}
 
 
setDefaultTarget ( retrieveDependencies )

and a sample ivy.xml file

<ivy-module version="1.0">
    <info organisation="jayasoft" module="hello-ivy" />
    <dependencies>
        <dependency org="org.seleniumhq.webdriver" name="webdriver-parent" rev="0.9.7376"/>
        <dependency org="net.sourceforge.htmlunit" name="htmlunit" rev="2.9"/>
    </dependencies>
</ivy-module>

Unzip

  ant.unzip( src:"Highcharts-2.1.6.zip"
       , dest:'public/javascripts/highcharts', 
       overwrite:"true"){
          patternset {
	    include('name': '**/?*.js')
	  }										
   };;
 
gant.txt · Last modified: 2012/02/07 02:24 by root
 
RSS - 200 © CrosswireDigitialMedia Ltd