Created
November 4, 2012 11:49
-
-
Save kimukou/4011576 to your computer and use it in GitHub Desktop.
task_add_test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.tools.ant.Project | |
import org.apache.tools.ant.ProjectHelper | |
def antFile = new File("./build.xml") | |
def project = new Project() | |
project.init() | |
ProjectHelper.configureProject(project, antFile); | |
/* | |
//==== NG ========= | |
import org.apache.tools.ant.BuildException | |
import org.apache.tools.ant.Task | |
class OriginalTask extends Task { | |
@Override | |
public void execute() throws BuildException { | |
ant.echo "aaa" | |
} | |
} | |
ant.taskdef(name:'orgTask' | |
,classpath:'.' | |
,classname:"OriginalTask" | |
) | |
project.executeTargets(['clean','orgTask','orgTask'] as Vector) | |
*/ | |
//==== OK ========= | |
project.addTarget( | |
ant.target(name: "orgTarget") { | |
ant.echo(message: "aaaaaaaa") | |
} | |
) | |
project.executeTargets(['orgTarget'] as Vector) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment