|
Groovy example source code file (GroovyTest.xml)
The Groovy GroovyTest.xml source code<?xml version="1.0" encoding="ISO-8859-1" ?> <project name="test-groovy-task" default="groovyCodeWithinTask" basedir="."> <target name="groovyCodeWithinTask" depends="defineTask"> <groovy> org.codehaus.groovy.ant.GroovyTest.FLAG = "from groovy inlined in ant" </groovy> </target> <target name="groovyCodeInExternalFile" depends="defineTask"> <groovy src="GroovyTest1.groovy"/> </target> <target name="groovyCodeInExternalFileWithOtherClass" depends="defineTask"> <groovy src="GroovyTest2.groovy"/> </target> <target name="groovyClasspath_missing" depends="defineTask" description="should fail!"> <groovy> def foo = new GroovyTest3Class() foo.doSomething() </groovy> </target> <target name="groovyClasspath_classpathAttribute" depends="defineTask"> <groovy classpath="groovytest3"> def foo = new GroovyTest3Class() foo.doSomething() </groovy> </target> <target name="groovyClasspath_classpathrefAttribute" depends="defineTask"> <path id="myClasspathRef"> <pathelement location="groovytest3"/> </path> <groovy classpathref="myClasspathRef"> def foo = new GroovyTest3Class() foo.doSomething() </groovy> </target> <target name="groovyClasspath_nestedClasspath" depends="defineTask"> <groovy> <classpath> <pathelement location="groovytest3"/> </classpath> def foo = new GroovyTest3Class() foo.doSomething() </groovy> </target> <target name="groovyArgUsage" depends="defineTask"> <groovy classpath="groovytest3"> <arg line="1 2 3"/> def foo = new GroovyTest3Class() foo.doSomethingWithArgs(args) </groovy> </target> <target name="groovyErrorMsg" depends="defineTask"> <groovy> // should produce an error message def f = { t.notExisting() } f() </groovy> </target> <target name="groovyErrorMsg_ExternalFile" depends="defineTask"> <groovy src="GroovyTest_errorMessage.groovy"/> </target> <target name="defineTask"> <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy"/> </target> </project> Other Groovy examples (source code examples)Here is a short list of links related to this Groovy GroovyTest.xml source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.