Cool Groovy features 5 – integration with Ant

The Ant build tool provides a number of really useful features, but when coding in Java it isn’t particularly easy to invoke Ant from your code. Groovy includes Ant and an AntBuilder class that allows you to access it, which makes it very easy to perform tasks like moving and copying files, ftp, sftp, zip and unzip:
AntBuilder antBuilder = new AntBuilder()
antBuilder.scp( file: "mysqlbackup@",
		  todir: "c:db_backups",
		  verbose: true,
		  password: "password",
		  trust: true,
		  sftp: true)
antBuilder.gunzip( src: "c:db_backupsdb_backup.sql.gz" )

This entry was posted in Groovy and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

HTML tags are not allowed.

516,722 Spambots Blocked by Simple Comments